Differences From Artifact [bcefce47daacc4a5]:
- File        
polemy/eval.d
- 2010-11-08 08:01:27 - part of checkin [b0d8d7875b] on branch trunk - polemy.runtime renamed into polemy.value. Also, in process of changes to use unittest helpers. (user: kinaba) [annotate]
 
 
To Artifact [baaa1d71de4dc9d8]:
- File        
polemy/eval.d
- 2010-11-08 08:45:51 - part of checkin [8d297342aa] on branch trunk - Replaced Token.Kind with bool quoted (user: kinaba) [annotate]
 
 
  173                                  ctxNeo.add(p, args[i]);                              173                                  ctxNeo.add(p, args[i]);
  174                          return eval(e.funbody, ctxNeo);                              174                          return eval(e.funbody, ctxNeo);
  175                  });                                                                  175                  });
  176          }                                                                            176          }
  177          throw new PolemyRuntimeException(sprintf!"Unknown Kind of Expression %s      177          throw new PolemyRuntimeException(sprintf!"Unknown Kind of Expression %s 
  178  }                                                                                    178  }
  179                                                                                       179  
  180  import std.stdio;                                                                <
                                                                                        >   180  /*
  181  unittest                                                                             181  unittest
  182  {                                                                                    182  {
  183          auto r = evalString(`var x = 21; x = x + x*x;`);                             183          auto r = evalString(`var x = 21; x = x + x*x;`);
  184          assert( r.val == new IntValue(BigInt(21+21*21)) );                           184          assert( r.val == new IntValue(BigInt(21+21*21)) );
  185          assert( r.ctx["x"] == new IntValue(BigInt(21+21*21)) );                      185          assert( r.ctx["x"] == new IntValue(BigInt(21+21*21)) );
  186          assert( !collectException(r.ctx["x"]) );                                     186          assert( !collectException(r.ctx["x"]) );
  187          assert( collectException(r.ctx["y"]) );                                      187          assert( collectException(r.ctx["y"]) );
................................................................................................................................................................................
  225                  if(x<2)                                                              225                  if(x<2)
  226                          { 1; }                                                       226                          { 1; }
  227                  else                                                                 227                  else
  228                          { fib(x-1) + fib(x-2); };                                    228                          { fib(x-1) + fib(x-2); };
  229          };                                                                           229          };
  230          print(fib(10));`);                                                           230          print(fib(10));`);
  231  }                                                                                    231  }
                                                                                        >   232  */