Guest User

Untitled

a guest
May 24th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. public static Object eval(Object form) throws Exception{
  2. boolean createdLoader = false;
  3. if(true)//!LOADER.isBound())
  4. {
  5. Var.pushThreadBindings(RT.map(LOADER, RT.makeClassLoader()));
  6. createdLoader = true;
  7. }
  8. try
  9. {
  10. if(form instanceof IPersistentCollection
  11. && !(RT.first(form) instanceof Symbol
  12. && ((Symbol) RT.first(form)).name.startsWith("def")))
  13. {
  14. FnExpr fexpr = (FnExpr) analyze(C.EXPRESSION, RT.list(FN, PersistentVector.EMPTY, form), "eval");
  15. IFn fn = (IFn) fexpr.eval();
  16. return fn.invoke();
  17. }
  18. else
  19. {
  20. Expr expr = analyze(C.EVAL, form);
  21. return expr.eval();
  22. }
  23. }
  24. catch(Throwable e)
  25. {
  26. if(!(e instanceof CompilerException))
  27. throw new CompilerException((String) SOURCE.deref(), (Integer) LINE.deref(), e);
  28. else
  29. throw (CompilerException) e;
  30. }
  31. finally
  32. {
  33. if(createdLoader)
  34. Var.popThreadBindings();
  35. }
  36. }
Add Comment
Please, Sign In to add comment