From 9bce1f72e329cb407b7a95589b9675a08129b65d Mon Sep 17 00:00:00 2001 From: Christian Linhart Date: Fri, 20 Jan 2017 14:40:25 +0100 Subject: [PATCH] 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 Signed-off-by: Christian Linhart --- src/c_client.py | 9 +-------- 1 file changed, 1 insertion(+), 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)