Skip to content

Commit

Permalink
Use specified context instead of current in "eval"
Browse files Browse the repository at this point in the history
  • Loading branch information
urbic committed May 10, 2024
1 parent b9314fa commit 105003a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ public interface PsyEvaluable
*
* @throws PsyErrorException when an error occurs durind evaluation of this object.
*/
public void psyEval()
public void psyEval(final PsyContext oContext)
throws PsyErrorException;

/**
* Context action of the {@code eval} operator.
*/
@OperatorType("eval")
public static final ContextAction PSY_EVAL
=ContextAction.<PsyEvaluable>ofConsumer(PsyEvaluable::psyEval);
public static final ContextAction PSY_EVAL=oContext->
oContext.operandStackBacked(1).<PsyEvaluable>getBacked(0).psyEval(oContext);
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ public PsyReader(final InputStream is)
}

@Override
public void psyEval()
public void psyEval(final PsyContext oContext)
throws PsyErrorException
{
// TODO
PsyContext.psyCurrentContext().interpret(this);
oContext.interpret(this);
}

public Reader reader()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ default public PsyName psyToName()
}

@Override
default public void psyEval()
default public void psyEval(final PsyContext oContext)
throws PsyErrorException
{
(new PsyStringReader(this)).psyEval();
(new PsyStringReader(this)).psyEval(oContext);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ public void interpret(final PsyReader oReader)
if(getStopped())
return;
}
// Incomplete procedure read
if(procstack.size()>initProcLevel)
{
var e=new PsySyntaxErrorException();
Expand Down Expand Up @@ -708,7 +709,7 @@ public boolean loadLibraryResource(final String resourceName)
else
{
resourceRegistry.put(resourceName, resourceID);
new PsyFileReader(oFullResourceName).psyEval();
new PsyFileReader(oFullResourceName).psyEval(this);
}
return true;
}
Expand Down

0 comments on commit 105003a

Please sign in to comment.