purge duplicate targets only once per macro
This commit is contained in:
parent
5f808f4cf6
commit
f96da2939c
|
@ -73,6 +73,9 @@ class OscCommentMacroListener(CommentMacroListener):
|
|||
lisp_tree_str = ctx.toStringTree(recog=ctx.parser)
|
||||
logger.info(beautify_lisp_string(lisp_tree_str))
|
||||
|
||||
# disallow duplicate targets
|
||||
ctx.targets = set(ctx.targets)
|
||||
|
||||
# execute macro from name
|
||||
name = ctx.children[0].getText()
|
||||
try:
|
||||
|
@ -86,7 +89,6 @@ class OscCommentMacroListener(CommentMacroListener):
|
|||
ctx.targets = []
|
||||
|
||||
def exitMaster(self, ctx: CommentMacroParser.MasterContext):
|
||||
ctx.targets = set(ctx.targets) # no duplicates
|
||||
if isinstance(ctx.parentCtx, CommentMacroParser.MacroContext):
|
||||
ctx.parentCtx.master = ctx
|
||||
|
||||
|
@ -116,7 +118,6 @@ class OscCommentMacroListener(CommentMacroListener):
|
|||
ctx.targets = []
|
||||
|
||||
def exitTarget(self, ctx: CommentMacroParser.TargetContext):
|
||||
ctx.target = set(ctx.targets) # no duplicates
|
||||
ctx.parentCtx.targets.extend(ctx.targets) # add to parent targets
|
||||
|
||||
def exitNodeType(self, ctx: CommentMacroParser.NodeTypeContext):
|
||||
|
|
Loading…
Reference in New Issue