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>
This commit is contained in:
parent
65b298c7ca
commit
9bce1f72e3
|
@ -1661,14 +1661,7 @@ def _c_accessor_get_expr(expr, field_mapping):
|
||||||
return c_name
|
return c_name
|
||||||
elif expr.op == 'sumof':
|
elif expr.op == 'sumof':
|
||||||
# locate the referenced list object
|
# locate the referenced list object
|
||||||
field = None
|
field = expr.lenfield
|
||||||
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)
|
|
||||||
list_name = field_mapping[field.c_field_name][0]
|
list_name = field_mapping[field.c_field_name][0]
|
||||||
c_length_func = "%s(%s)" % (field.c_length_name, list_name)
|
c_length_func = "%s(%s)" % (field.c_length_name, list_name)
|
||||||
c_length_func = _c_accessor_get_expr(field.type.expr, field_mapping)
|
c_length_func = _c_accessor_get_expr(field.type.expr, field_mapping)
|
||||||
|
|
Loading…
Reference in New Issue