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 else 173 else
174 t.set(e.tupleof[i].stringof[2..$], ValueLayer, a 174 t.set(e.tupleof[i].stringof[2..$], ValueLayer, a
175 return t; 175 return t;
176 } 176 }
177 else 177 else
178 static assert(false, "unknown type <"~T.stringof~"> during AST e 178 static assert(false, "unknown type <"~T.stringof~"> during AST e
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 }