Differences From Artifact [cd634c9bb4b6ba14]:
- File
polemy/valueconv.d
- 2010-11-24 13:22:04 - part of checkin [f9c31f3cd8] on branch trunk - Fixed the null dereference bug when directly wrote "case 1 when 2: 3" in REPL. It was due to null LexPosition in the AST. Now AST.pos !is null is an invariant of AST. (user: kinaba) [annotate]
To Artifact [56ac5c69da3fe94e]:
- File
polemy/valueconv.d
- 2010-11-26 15:13:58 - part of checkin [6760e0dd02] on branch trunk - evaluator refactoring done. x6 speed up. (user: kinaba) [annotate]
173 173 else
174 174 t.set(e.tupleof[i].stringof[2..$], ValueLayer, ast2table(m,rec));
175 175 return t;
176 176 }
177 177 else
178 178 static assert(false, "unknown type <"~T.stringof~"> during AST encoding");
179 179 }
180 +
181 +/// No hook version
182 +Value ast2table(T)(T e)
183 +{
184 + //[TODO] I really need to automate this!!!!!!!!!!!!1
185 + Value rec(AST _) {
186 + if(auto e = cast(Str)_) return ast2table(e, &rec);
187 + if(auto e = cast(Int)_) return ast2table(e, &rec);
188 + if(auto e = cast(Var)_) return ast2table(e, &rec);
189 + if(auto e = cast(Die)_) return ast2table(e, &rec);
190 + if(auto e = cast(Let)_) return ast2table(e, &rec);
191 + if(auto e = cast(Lay)_) return ast2table(e, &rec);
192 + if(auto e = cast(App)_) return ast2table(e, &rec);
193 + if(auto e = cast(Fun)_) return ast2table(e, &rec);
194 + assert(false);
195 + }
196 + return rec(e);
197 +}