def __getattr__(self, aname): em = object.__getattribute__(self, "em") # This pops 'this expr' off the stack, so we can # replace it with an extended expression # pop_expr() ret = None if isinstance(em, ExprArraySubscriptModel): # TODO: Need to get the core type fm = None if isinstance(em.lhs, ExprIndexedFieldRefModel): fm = em.lhs.get_target() elif isinstance(em.lhs, ExprFieldRefModel): fm = em.lhs.fm else: raise Exception("Unsupported path-chaining expression " + str(em.lhs)) if aname in fm.type_t.field_id_m.keys(): idx = fm.type_t.field_id_m[aname] ret = expr(ExprIndexedFieldRefModel(em, [idx])) else: raise Exception("Type %s does not contain a field \"%s\"" % (fm.type_t.name, aname)) else: raise Exception( "Expression getattribute access on non-subscript") return ret
def __call__(self): return expr(ExprDynRefModel(self.model))
def to_expr(self): return expr(self.em)
def to_expr(self): return expr(ExprFieldRefModel(self.index))