Fix bug that evaluator.thread was not set when parsing scripts.
This commit is contained in:
parent
a4e36e6ae3
commit
ab14bbb898
1 changed files with 11 additions and 6 deletions
|
@ -123,6 +123,8 @@ public class FesiEngine implements ScriptingEngine {
|
||||||
* necessary to bootstrap the rest is parsed.
|
* necessary to bootstrap the rest is parsed.
|
||||||
*/
|
*/
|
||||||
private void initialize () {
|
private void initialize () {
|
||||||
|
// set the thread filed in the FESI evaluator
|
||||||
|
evaluator.thread = Thread.currentThread ();
|
||||||
Collection protos = app.getPrototypes();
|
Collection protos = app.getPrototypes();
|
||||||
for (Iterator i=protos.iterator(); i.hasNext(); ) {
|
for (Iterator i=protos.iterator(); i.hasNext(); ) {
|
||||||
Prototype proto = (Prototype) i.next ();
|
Prototype proto = (Prototype) i.next ();
|
||||||
|
@ -132,13 +134,14 @@ public class FesiEngine implements ScriptingEngine {
|
||||||
// we always need it and there's no chance to trigger
|
// we always need it and there's no chance to trigger
|
||||||
// creation on demand.
|
// creation on demand.
|
||||||
getPrototype ("global");
|
getPrototype ("global");
|
||||||
|
evaluator.thread = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize a prototype without fully parsing its script files.
|
* Initialize a prototype without fully parsing its script files.
|
||||||
*/
|
*/
|
||||||
void initPrototype (Prototype prototype) {
|
void initPrototype (Prototype prototype) {
|
||||||
// System.err.println ("FESI INIT PROTO "+prototype);
|
// System.err.println ("FESI INIT PROTO "+prototype);
|
||||||
ObjectPrototype op = null;
|
ObjectPrototype op = null;
|
||||||
|
|
||||||
// get the prototype's prototype if possible and necessary
|
// get the prototype's prototype if possible and necessary
|
||||||
|
@ -193,7 +196,7 @@ public class FesiEngine implements ScriptingEngine {
|
||||||
* Set up a prototype, parsing and compiling all its script files.
|
* Set up a prototype, parsing and compiling all its script files.
|
||||||
*/
|
*/
|
||||||
void evaluatePrototype (Prototype prototype) {
|
void evaluatePrototype (Prototype prototype) {
|
||||||
// System.err.println ("FESI EVALUATE PROTO "+prototype+" FOR "+this);
|
// System.err.println ("FESI EVALUATE PROTO "+prototype+" FOR "+this);
|
||||||
ObjectPrototype op = null;
|
ObjectPrototype op = null;
|
||||||
|
|
||||||
// get the prototype's prototype if possible and necessary
|
// get the prototype's prototype if possible and necessary
|
||||||
|
@ -231,7 +234,7 @@ public class FesiEngine implements ScriptingEngine {
|
||||||
|
|
||||||
// Register a constructor for all types except global.
|
// Register a constructor for all types except global.
|
||||||
// This will first create a new prototyped hopobject and then calls
|
// This will first create a new prototyped hopobject and then calls
|
||||||
// the actual (scripted) constructor on it.
|
// the actual (scripted) constructor on it.
|
||||||
if (!"global".equalsIgnoreCase (name) && !"root".equalsIgnoreCase (name)) {
|
if (!"global".equalsIgnoreCase (name) && !"root".equalsIgnoreCase (name)) {
|
||||||
try {
|
try {
|
||||||
FunctionPrototype fp = (FunctionPrototype) evaluator.getFunctionPrototype();
|
FunctionPrototype fp = (FunctionPrototype) evaluator.getFunctionPrototype();
|
||||||
|
@ -268,6 +271,8 @@ public class FesiEngine implements ScriptingEngine {
|
||||||
* engine know it should update its prototype information.
|
* engine know it should update its prototype information.
|
||||||
*/
|
*/
|
||||||
public void updatePrototypes () {
|
public void updatePrototypes () {
|
||||||
|
// set the thread filed in the FESI evaluator
|
||||||
|
evaluator.thread = Thread.currentThread ();
|
||||||
Collection protos = app.getPrototypes();
|
Collection protos = app.getPrototypes();
|
||||||
for (Iterator i=protos.iterator(); i.hasNext(); ) {
|
for (Iterator i=protos.iterator(); i.hasNext(); ) {
|
||||||
Prototype proto = (Prototype) i.next ();
|
Prototype proto = (Prototype) i.next ();
|
||||||
|
|
Loading…
Add table
Reference in a new issue