aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/ast/interpreter.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-12-07 19:18:26 +0100
committerDaniel Mensinger <daniel@mensinger-ka.de>2020-03-02 10:34:55 +0100
commita75255bc4ce992721bf9f94c3d64ee10c77d7191 (patch)
tree2d377d27ff90b2674b78c7b17d39b8856be83c64 /mesonbuild/ast/interpreter.py
parentc14aea2812fd2be94998bdb174e9a4681aeea394 (diff)
downloadmeson-a75255bc4ce992721bf9f94c3d64ee10c77d7191.zip
meson-a75255bc4ce992721bf9f94c3d64ee10c77d7191.tar.gz
meson-a75255bc4ce992721bf9f94c3d64ee10c77d7191.tar.bz2
types: Annotate the AST visitors
Diffstat (limited to 'mesonbuild/ast/interpreter.py')
-rw-r--r--mesonbuild/ast/interpreter.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py
index 09d8d32..e2f4e12 100644
--- a/mesonbuild/ast/interpreter.py
+++ b/mesonbuild/ast/interpreter.py
@@ -190,7 +190,7 @@ class AstInterpreter(interpreterbase.InterpreterBase):
self.assignments[node.var_name] = []
self.assign_vals[node.var_name] = []
self.assignments[node.var_name] += [node.value] # Save a reference to the value node
- if hasattr(node.value, 'ast_id'):
+ if node.value.ast_id:
self.reverse_assignment[node.value.ast_id] = node
self.assign_vals[node.var_name] += [self.evaluate_statement(node.value)]
@@ -250,7 +250,7 @@ class AstInterpreter(interpreterbase.InterpreterBase):
def assignment(self, node):
assert(isinstance(node, AssignmentNode))
self.assignments[node.var_name] = [node.value] # Save a reference to the value node
- if hasattr(node.value, 'ast_id'):
+ if node.value.ast_id:
self.reverse_assignment[node.value.ast_id] = node
self.assign_vals[node.var_name] = [self.evaluate_statement(node.value)] # Evaluate the value just in case
@@ -274,7 +274,7 @@ class AstInterpreter(interpreterbase.InterpreterBase):
if not isinstance(node, BaseNode):
return None
- assert(hasattr(node, 'ast_id'))
+ assert node.ast_id
if node.ast_id in id_loop_detect:
return None # Loop detected
id_loop_detect += [node.ast_id]