Skip to content

Commit

Permalink
reducing indirection
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanqasaur committed Jun 26, 2015
1 parent 18fa407 commit 80e6156
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 0 additions & 5 deletions JeevesLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ def concretize(ctxt, v):
# jeevesState.concretecache.cache_value(cache_key, cval)
# return cval

@supports_jeeves
def assignLabel(label):
pathvars = jeevesState.pathenv.getEnv()
return jeevesState.solverstate.assignLabel(label, pathvars)

@supports_jeeves
def jif(cond, thn_fn, els_fn):
condTrans = fexpr_cast(cond).partialEval(jeevesState.pathenv.getEnv())
Expand Down
9 changes: 6 additions & 3 deletions jeevesdb/JeevesModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,18 @@ def get(self, use_base_env=False, skip_optimize=False, **kwargs):
viewer = JeevesLib.get_viewer()
has_viewer = not isinstance(viewer, FNull)

pathenv = JeevesLib.jeevesState.pathenv.getEnv()
solverstate = JeevesLib.get_solverstate()

cur = None
for (row, conditions) in matches:
old = cur
cur = FObject(row)
for var_name, val in conditions.iteritems():
label = acquire_label_by_name(self.model._meta.app_label
, var_name, obj=row)
viewer = JeevesLib.get_viewer()
if has_viewer and not skip_optimize:
if JeevesLib.assignLabel(label):
if solverstate.assignLabel(label, pathenv):
if not val:
cur = old
else:
Expand Down Expand Up @@ -134,14 +136,15 @@ def all(self):
# Otherwise concretize early.
elements = []
env = JeevesLib.jeevesState.pathenv.getEnv()
solverstate = JeevesLib.get_solverstate()

for val, cond in self.get_jiter():
for vname, vval in cond.iteritems():
if vname not in env:
vlabel = acquire_label_by_name(
self.model._meta.app_label, vname
, obj=val)
label = JeevesLib.assignLabel(vlabel)
label = solverstate.assignLabel(vlabel, env)
if label == vval:
elements.append(val)
return elements
Expand Down

0 comments on commit 80e6156

Please sign in to comment.