diff options
author | Daniel Schulte <trilader@schroedingers-bit.net> | 2018-10-10 23:13:53 +0200 |
---|---|---|
committer | Daniel Schulte <trilader@schroedingers-bit.net> | 2018-11-26 23:10:53 +0100 |
commit | 8c9c5199f9c2c08190e424ffcaed6d54b8c47184 (patch) | |
tree | 0bee38ff4ce0b3bf761b93edd1d86a5a88b0a3f8 | |
parent | bdc9f6846c681dc956eae1c9fa6728755c69351d (diff) | |
download | meson-8c9c5199f9c2c08190e424ffcaed6d54b8c47184.zip meson-8c9c5199f9c2c08190e424ffcaed6d54b8c47184.tar.gz meson-8c9c5199f9c2c08190e424ffcaed6d54b8c47184.tar.bz2 |
AstInterpreter: Stub out more functions
This commit disables more functions inherited from InterpreterBase that
we don't need for AST evaluation.
-rw-r--r-- | mesonbuild/astinterpreter.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/mesonbuild/astinterpreter.py b/mesonbuild/astinterpreter.py index 686572b..a447a55 100644 --- a/mesonbuild/astinterpreter.py +++ b/mesonbuild/astinterpreter.py @@ -18,7 +18,7 @@ from . import interpreterbase, mlog, mparser, mesonlib from . import environment -from .interpreterbase import InterpreterException, InvalidArguments +from .interpreterbase import InterpreterException, InvalidArguments, BreakRequest, ContinueRequest import os, sys @@ -105,7 +105,7 @@ class AstInterpreter(interpreterbase.InterpreterBase): return 0 def unknown_function_called(self, func_name): - mlog.warning('Unknown function called: ' + func_name) + pass def reduce_arguments(self, args): assert(isinstance(args, mparser.ArgumentNode)) @@ -113,6 +113,29 @@ class AstInterpreter(interpreterbase.InterpreterBase): raise InvalidArguments('All keyword arguments must be after positional arguments.') return args.arguments, args.kwargs + def evaluate_comparison(self, node): + return False + + def evaluate_foreach(self, node): + try: + self.evaluate_codeblock(node.block) + except ContinueRequest: + pass + except BreakRequest: + pass + + def evaluate_if(self, node): + for i in node.ifs: + self.evaluate_codeblock(i.block) + if not isinstance(node.elseblock, mparser.EmptyNode): + self.evaluate_codeblock(node.elseblock) + + def get_variable(self, varname): + return 0 + + def assignment(self, node): + pass + class RewriterInterpreter(AstInterpreter): def __init__(self, source_root, subdir): super().__init__(source_root, subdir) |