summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Linhart <chris@demorecorder.com>2017-01-20 14:40:25 +0100
committerChristian Linhart <chris@demorecorder.com>2017-03-11 10:51:11 +0100
commit9bce1f72e329cb407b7a95589b9675a08129b65d (patch)
treec2a26c57fd007fdaeb53c20915ab7cbfe206d5ac
parent65b298c7ca317d7e4316aa2b9e0499e13047c65c (diff)
move symbol lookup of sumof expr to the parser
replace the complicated symboltable lookup for sumof expr by accessing the lenfield of the expr-object. This requires the corresponding patch for xcb/proto which sets the lenfield accordingly. This should be OK because for official releases we define that dependency in the build system. For getting versions off the HEAD of the git repo, it should be obvious that xcb/proto and xcb/libxcb have to be updated together. I have tested this patch and it generates exactly the same code as before. Tested-by: Christian Linhart <chris@demorecorder.com> Signed-off-by: Christian Linhart <chris@demorecorder.com>
-rw-r--r--src/c_client.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/c_client.py b/src/c_client.py
index 043338d..b0eb47c 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1661,14 +1661,7 @@ def _c_accessor_get_expr(expr, field_mapping):
return c_name
elif expr.op == 'sumof':
# locate the referenced list object
- field = None
- for f in expr.lenfield_parent.fields:
- if f.field_name == expr.lenfield_name:
- field = f
- break
-
- if field is None:
- raise Exception("list field '%s' referenced by sumof not found" % expr.lenfield_name)
+ field = expr.lenfield
list_name = field_mapping[field.c_field_name][0]
c_length_func = "%s(%s)" % (field.c_length_name, list_name)
c_length_func = _c_accessor_get_expr(field.type.expr, field_mapping)