Differences From Artifact [bd6a863bd24c7016]:
- File
polemy/eval.d
- 2010-11-24 12:14:00 - part of checkin [3ae09b8cbf] on branch trunk - changed if-then-else syntax (user: kinaba) [annotate]
To Artifact [197c2cfb75326106]:
- File
polemy/eval.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]
411 enrollRuntimeLibrary(e); 411 enrollRuntimeLibrary(e);
412 assert_nothrow( e.evalString(` 412 assert_nothrow( e.evalString(`
413 @macro twice(x) { x; x }; 413 @macro twice(x) { x; x };
414 def main() { twice(1) }; 414 def main() { twice(1) };
415 main() 415 main()
416 `) ); 416 `) );
417 } 417 }
> 418 unittest
> 419 {
> 420 auto e = new Evaluator;
> 421 enrollRuntimeLibrary(e);
> 422 assert_nothrow( e.evalString(`case 1`) );
> 423 assert_nothrow( e.evalString(`case 1 when 1: 2`) );
> 424 }
> 425
418 /* 426 /*
419 unittest 427 unittest
420 { 428 {
421 assert_eq( evalString(`var fac = fun(x){ 429 assert_eq( evalString(`var fac = fun(x){
422 if(x) 430 if(x)
423 { x*fac(x-1); } 431 { x*fac(x-1); }
424 else 432 else