From 7c50acd7bc54a16c54996be5c7b86406c94c8b49 Mon Sep 17 00:00:00 2001 From: paltherr Date: Thu, 13 Mar 2003 15:33:17 +0000 Subject: - Updated evaluator to cope with module singlet... - Updated evaluator to cope with module singleton initialization in module constructor --- sources/scala/tools/scalai/Evaluator.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'sources') diff --git a/sources/scala/tools/scalai/Evaluator.java b/sources/scala/tools/scalai/Evaluator.java index 07b5b025f8..25a0553843 100644 --- a/sources/scala/tools/scalai/Evaluator.java +++ b/sources/scala/tools/scalai/Evaluator.java @@ -358,6 +358,9 @@ public class Evaluator { // !!! System.out.println("!!! store Context: level = " + level + ", index = " + index); return variables[level][index] = value; + case Module(_, _): + return ((Variable.Module)variable).value = value; + case Member(int index): // !!! handle case where object is null // !!! System.out.println("!!! store Member: index = " + index + ", length = " + getScalaObject(object).variables.length); @@ -405,12 +408,10 @@ public class Evaluator { return variables[level][index]; case Module(CodePromise body, Object value): - if (value == null) { - // !!! - ((Variable.Module)variable).value = value = evaluate(body.force().code); - ((Variable.Module)variable).body = null; - } - return value; + if (value != null) return value; + ((Variable.Module)variable).body = null; + evaluate(body.force().code); + return load(object, variable); case Member(int index): // !!! handle case where object is null -- cgit v1.2.3