Skip to content

Commit

Permalink
Added context handling to call evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminSchaaf committed Aug 17, 2016
1 parent 1feae40 commit deefb6e
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions compiler/interpreter/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,24 @@ def Literal_eval(self):

@patch
def Call_eval(self):
values = [value.eval() for value in self.values]
with State.selfScope(self.called):
called = self.function.eval()

with State.selfScope(self.called.evalContext()):
return self.function.evalCall(values)
# Hack, for now
scope = ExitStack()
if isinstance(self.function, lekvar.DependentTarget):
scope = self.function.target()

with scope:
values = [value.eval() for value in self.values]

context = self.called.evalContext()
with State.selfScope(context):
return called.evalCall(values)

@patch
def Call_evalContext(self):
return self.called.evalContext()

#
# class Return
Expand Down

0 comments on commit deefb6e

Please sign in to comment.