Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Object eval(Object form) throws Exception{
- boolean createdLoader = false;
- if(true)//!LOADER.isBound())
- {
- Var.pushThreadBindings(RT.map(LOADER, RT.makeClassLoader()));
- createdLoader = true;
- }
- try
- {
- if(form instanceof IPersistentCollection
- && !(RT.first(form) instanceof Symbol
- && ((Symbol) RT.first(form)).name.startsWith("def")))
- {
- FnExpr fexpr = (FnExpr) analyze(C.EXPRESSION, RT.list(FN, PersistentVector.EMPTY, form), "eval");
- IFn fn = (IFn) fexpr.eval();
- return fn.invoke();
- }
- else
- {
- Expr expr = analyze(C.EVAL, form);
- return expr.eval();
- }
- }
- catch(Throwable e)
- {
- if(!(e instanceof CompilerException))
- throw new CompilerException((String) SOURCE.deref(), (Integer) LINE.deref(), e);
- else
- throw (CompilerException) e;
- }
- finally
- {
- if(createdLoader)
- Var.popThreadBindings();
- }
- }
Add Comment
Please, Sign In to add comment