(Object reader, Object eq, Object opts, Object pendingForms)
| 1295 | |
| 1296 | public static class EvalReader extends AFn{ |
| 1297 | public Object invoke(Object reader, Object eq, Object opts, Object pendingForms) { |
| 1298 | if (!RT.booleanCast(RT.READEVAL.deref())) |
| 1299 | { |
| 1300 | throw Util.runtimeException("EvalReader not allowed when *read-eval* is false."); |
| 1301 | } |
| 1302 | |
| 1303 | PushbackReader r = (PushbackReader) reader; |
| 1304 | Object o = read(r, true, null, true, opts, ensurePending(pendingForms)); |
| 1305 | if(o instanceof Symbol) |
| 1306 | { |
| 1307 | return RT.classForName(o.toString()); |
| 1308 | } |
| 1309 | else if(o instanceof IPersistentList) |
| 1310 | { |
| 1311 | Symbol fs = (Symbol) RT.first(o); |
| 1312 | if(fs.equals(THE_VAR)) |
| 1313 | { |
| 1314 | Symbol vs = (Symbol) RT.second(o); |
| 1315 | return RT.var(vs.ns, vs.name); //Compiler.resolve((Symbol) RT.second(o),true); |
| 1316 | } |
| 1317 | if(fs.name.endsWith(".")) |
| 1318 | { |
| 1319 | Object[] args = RT.toArray(RT.next(o)); |
| 1320 | return Reflector.invokeConstructor(RT.classForName(fs.name.substring(0, fs.name.length() - 1)), args); |
| 1321 | } |
| 1322 | if(Compiler.namesStaticMember(fs)) |
| 1323 | { |
| 1324 | Object[] args = RT.toArray(RT.next(o)); |
| 1325 | return Reflector.invokeStaticMethod(fs.ns, fs.name, args); |
| 1326 | } |
| 1327 | Object v = Compiler.maybeResolveIn(Compiler.currentNS(), fs); |
| 1328 | if(v instanceof Var) |
| 1329 | { |
| 1330 | return ((IFn) v).applyTo(RT.next(o)); |
| 1331 | } |
| 1332 | throw Util.runtimeException("Can't resolve " + fs); |
| 1333 | } |
| 1334 | else |
| 1335 | throw new IllegalArgumentException("Unsupported #= form"); |
| 1336 | } |
| 1337 | } |
| 1338 | |
| 1339 | //static class ArgVectorReader extends AFn{ |
nothing calls this directly
no test coverage detected