Differences From Artifact [eb7f695558db6c0f]:
- File
polemy/runtime.d
- 2010-11-07 14:34:29 - part of checkin [0569f7b8c2] on branch trunk - - Added function literal evaluator (i.e., closure). - Workaround for d2stacktrace's infinite-loop bug. (when std.demangle.demangle use exception inside it, it will go into an infinite loop. to avoid this, I choose to unset TraceHandler during stacktrace generation. This is far from the complete solution, but at least it should work as expected under single-thread environment...) (user: kinaba) [annotate]
To Artifact [2eb228662dba6e2d]:
- File
polemy/runtime.d
- 2010-11-07 15:03:38 - part of checkin [820e7198cc] on branch trunk - Made helloworld work. (user: kinaba) [annotate]
18 { 18 {
19 } 19 }
20 20
21 class UndefinedValue : Value 21 class UndefinedValue : Value
22 { 22 {
23 mixin SimpleConstructor; 23 mixin SimpleConstructor;
24 mixin SimpleCompare; 24 mixin SimpleCompare;
> 25 override string toString() const { return "(undefined)"; }
25 } 26 }
26 27
27 class IntValue : Value 28 class IntValue : Value
28 { 29 {
29 BigInt data; 30 BigInt data;
30 mixin SimpleConstructor; 31 mixin SimpleConstructor;
31 mixin SimpleCompare; 32 mixin SimpleCompare;
> 33 override string toString() const {
> 34 const(char)[] cs; data.toString((const(char)[] s){cs=s;}, null);
> 35 return to!string(cs);
> 36 }
32 } 37 }
33 38
34 class StrValue : Value 39 class StrValue : Value
35 { 40 {
36 string data; 41 string data;
37 mixin SimpleConstructor; 42 mixin SimpleConstructor;
38 mixin SimpleCompare; 43 mixin SimpleCompare;
> 44 override string toString() const { return data; }
39 } 45 }
40 46
41 class FunValue : Value 47 class FunValue : Value
42 { 48 {
43 Value delegate(immutable LexPosition pos, Value[]) data; 49 Value delegate(immutable LexPosition pos, Value[]) data;
44 mixin SimpleConstructor; 50 mixin SimpleConstructor;
45 Value call(immutable LexPosition pos, Value[] args) { return data(pos,ar 51 Value call(immutable LexPosition pos, Value[] args) { return data(pos,ar
> 52 override string toString() const { return sprintf!"(function:%s:%s)"(dat
46 } 53 }
47 import std.stdio; 54 import std.stdio;
48 class Context 55 class Context
49 { 56 {
50 Context parent; 57 Context parent;
51 Value[string] table; 58 Value[string] table;
52 this(Context parent = null) { this.parent = parent; } 59 this(Context parent = null) { this.parent = parent; }