Skip to content

Commit

Permalink
Support interpolation including parameterized goal params #153
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Jan 3, 2024
1 parent c813c37 commit 5f5c402
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -637,9 +637,11 @@ function instantiateGoals( i,l,goalName) {
# args: { F => "file1" }
#
function instantiate(goal,args,newArgs, i,j,depArg,depArgType,dep,goalNameInstantiated,argsCnt,gi,gii,argsCode,a) { # -> goalNameInstantiated
if (goal in Instantiated) return goal
# indent(IDepth++); print "instantiating " goal " { " renderArgs(args) "} ..."

goalNameInstantiated = instantiateGoalName(goal, args)
Instantiated[goalNameInstantiated]

if (goalNameInstantiated != goal) {
if (!(goalNameInstantiated in GoalsByName))
Expand All @@ -666,9 +668,10 @@ function instantiate(goal,args,newArgs, i,j,depArg,depArgType,dep,goalNameInst
# argsCnt = +DependencyArgsCnt[gi]

argsCnt = 0
# print "gi="gi
if (gi in DependencyArgsNR) {
# already should not fails syntax - we don't check result code
delete a
# already should not fails syntax - we don't check result code
parseCli_2(Lines[DependencyArgsNR[gi]],args,Vars,a)
# print "$$ "Lines[DependencyArgsNR[gi]]
# print "## "(a[-7]-3)", "argsCnt
Expand All @@ -677,10 +680,11 @@ function instantiate(goal,args,newArgs, i,j,depArg,depArgType,dep,goalNameInst
argsCnt = a[-7]-3 # TODO comment
}

# print "## "argsCnt","GoalParamsCnt[dep]
# print "#"dep"# "argsCnt","GoalParamsCnt[dep]
# we do not report wrong args count for unknown deps
if (dep in GoalsByName && argsCnt != GoalParamsCnt[dep])
addErrorDedup("wrong args count for '" dep "'", DependenciesLineNo[gi])
if (dep in GoalsByName && argsCnt != GoalParamsCnt[dep]) {
# print ">>>err"
addErrorDedup("wrong args count for '" dep "'", DependenciesLineNo[gi])}

# indent(IDepth); print ">dep=" dep ", argsCnt[" gi "]=" argsCnt

Expand All @@ -704,9 +708,12 @@ function instantiate(goal,args,newArgs, i,j,depArg,depArgType,dep,goalNameInst
}

gii = goalNameInstantiated SUBSEP i
# print "gii="gii
# dbgA("newArgs",newArgs)
Dependencies[gii] = instantiate(dep, newArgs)
DependenciesLineNo[gii] = DependenciesLineNo[gi]
delete DependencyArgsNR[gi]
# print "del for '"gi"'"
# delete DependencyArgsNR[gi]
# DependencyArgsCnt[gii] = 0
}

Expand Down
2 changes: 1 addition & 1 deletion tests/28_revamp_define.tush
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/28_revamp_define_3_issue152.sh -l
| pg@bbb

$ cd "$MYDIR"; ./$MAKESURE -f tests/28_revamp_define_4_interpolation_including_pg_params.sh g
| goal 'pg1@hello ' ...
| goal 'pg1@hello world' ...
| hello world
| goal 'pg@world' [empty].
| goal 'g' [empty].

0 comments on commit 5f5c402

Please sign in to comment.