diff options
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/ast/interpreter.py | 10 | ||||
-rw-r--r-- | mesonbuild/ast/introspection.py | 2 | ||||
-rw-r--r-- | mesonbuild/mconf.py | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py index eb9cb9f..5354710 100644 --- a/mesonbuild/ast/interpreter.py +++ b/mesonbuild/ast/interpreter.py @@ -260,6 +260,12 @@ class AstInterpreter(interpreterbase.InterpreterBase): id_loop_detect = [] flattend_args = [] + if isinstance(args, BaseNode): + assert(hasattr(args, 'ast_id')) + if args.ast_id in id_loop_detect: + return [] # Loop detected + id_loop_detect += [args.ast_id] + if isinstance(args, ArrayNode): args = [x for x in args.args.arguments] @@ -301,8 +307,8 @@ class AstInterpreter(interpreterbase.InterpreterBase): # Resolve the contents of args for i in args: - if isinstance(i, IdNode) and i.value not in id_loop_detect: - flattend_args += self.flatten_args(quick_resolve(i), include_unknown_args, id_loop_detect + [i.value]) + if isinstance(i, IdNode): + flattend_args += self.flatten_args(quick_resolve(i), include_unknown_args, id_loop_detect) elif isinstance(i, (ArrayNode, ArgumentNode, ArithmeticNode, MethodNode)): flattend_args += self.flatten_args(i, include_unknown_args, id_loop_detect) elif isinstance(i, mparser.ElementaryNode): diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py index b6ec450..5ac6133 100644 --- a/mesonbuild/ast/introspection.py +++ b/mesonbuild/ast/introspection.py @@ -118,7 +118,7 @@ class IntrospectionInterpreter(AstInterpreter): subproject_dir_abs = os.path.join(self.environment.get_source_dir(), self.subproject_dir) subpr = os.path.join(subproject_dir_abs, dirname) try: - subi = IntrospectionInterpreter(subpr, '', self.backend, cross_file=self.cross_file, subproject=dirname, subproject_dir=self.subproject_dir, env=self.environment) + subi = IntrospectionInterpreter(subpr, '', self.backend, cross_file=self.cross_file, subproject=dirname, subproject_dir=self.subproject_dir, env=self.environment, visitors=self.visitors) subi.analyze() subi.project_data['name'] = dirname self.project_data['subprojects'] += [subi.project_data] diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index cd9d35a..3b50d55 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -14,6 +14,7 @@ import os from . import coredata, environment, mesonlib, build, mintro, mlog +from .ast import AstIDGenerator def add_arguments(parser): coredata.register_builtin_arguments(parser) @@ -52,7 +53,7 @@ class Conf: # Make sure that log entries in other parts of meson don't interfere with the JSON output mlog.disable() self.source_dir = os.path.abspath(os.path.realpath(self.build_dir)) - intr = mintro.IntrospectionInterpreter(self.source_dir, '', 'ninja') + intr = mintro.IntrospectionInterpreter(self.source_dir, '', 'ninja', visitors = [AstIDGenerator()]) intr.analyze() # Reenable logging just in case mlog.enable() |