diff --git a/stmts.py b/stmts.py index 06e9d7f2b790010dccc4f72802a4eb791785b145_c3RtdHMucHk=..6cccc53a9ebea79f7ca26756e57542b6f48b0dd6_c3RtdHMucHk= 100644 --- a/stmts.py +++ b/stmts.py @@ -349,4 +349,7 @@ restriction = [] if unsimplified and self.stinfo['rewritten']: vvalues = {} + # hact to avoid actually replacing introduced const node: + # replace const value by variable value and set constant type to Int + # to avoid quoting for vname, consts in self.stinfo['rewritten'].iteritems(): @@ -352,5 +355,6 @@ for vname, consts in self.stinfo['rewritten'].iteritems(): - vvalues[vname] = consts[0].value - restriction.append('%s eid %s' % (vname, consts[0].value)) + eid = consts[0].eval(kwargs) + vvalues[vname] = (consts[0].type, eid) + restriction.append('%s eid %s' % (vname, eid)) for const in consts: const.value = vname @@ -355,5 +359,6 @@ for const in consts: const.value = vname + const.type = 'Int' s = [','.join(as_string(term) for term in self.selection)] if self.groupby: s.append('GROUPBY ' + ','.join(as_string(term) @@ -377,7 +382,7 @@ if unsimplified and self.stinfo['rewritten']: for vname, consts in self.stinfo['rewritten'].iteritems(): for const in consts: - const.value = vvalues[vname] + const.type, const.value = vvalues[vname] return 'Any ' + ' '.join(s) def copy(self, copy_solutions=True, solutions=None):