Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
electrikmilk committed Nov 2, 2022
1 parent 62345ec commit 41069f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion action.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ func validActionOutput(field string, validType tokenType, value any) {
if actionOutputType != "" {
if actionOutputType != validType {
parserError(
fmt.Sprintf("Invalid variable value of action '%v' that outputs type '%s' for argument '%s' of type '%s' in '%s()'",
fmt.Sprintf(
"Invalid variable value of action '%v' that outputs type '%s' for argument '%s' of type '%s' in '%s()'",
actionIdent+"()",
typeName(actionOutputType),
field,
Expand Down
9 changes: 5 additions & 4 deletions plist.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,19 +429,20 @@ func attachmentValues(key string, variable string, varUUID string, outputType pl
var coerce string
for _, chr := range variableChars {
if collectingVariable {
if collectingGetAs {
switch {
case collectingGetAs:
if chr == "]" {
collectingGetAs = false
continue
}
getAs += chr
} else if collectingCoerce {
case collectingCoerce:
if chr == ")" {
collectingCoerce = false
continue
}
coerce += chr
} else {
default:
if chr == "}" {
varIndex[varNum] = attachmentVariable{
varName: currentVariable,
Expand Down Expand Up @@ -631,7 +632,7 @@ func argumentValue(key string, args []actionArgument, idx int) plistData {
var actionArg = actions[currentAction].parameters[idx]
var arg actionArgument
if len(args) <= idx {
if actionArg.optional == true {
if actionArg.optional {
return plistData{}
}
if actionArg.defaultValue.value != nil {
Expand Down

0 comments on commit 41069f0

Please sign in to comment.