(C context, Object frm)
| 7236 | |
| 7237 | static class Parser implements IParser{ |
| 7238 | public Expr parse(C context, Object frm) { |
| 7239 | int line = lineDeref(); |
| 7240 | int column = columnDeref(); |
| 7241 | String source = (String) SOURCE.deref(); |
| 7242 | |
| 7243 | // In :once fn, recur to head invalidates :once |
| 7244 | ObjMethod method = (ObjMethod)METHOD.deref(); |
| 7245 | if(method.objx.onceOnly && method.clearRoot == CLEAR_ROOT.deref()) |
| 7246 | method.objx.onceOnly = false; |
| 7247 | |
| 7248 | ISeq form = (ISeq) frm; |
| 7249 | IPersistentVector loopLocals = (IPersistentVector) LOOP_LOCALS.deref(); |
| 7250 | if(context != C.RETURN || loopLocals == null) |
| 7251 | throw new UnsupportedOperationException("Can only recur from tail position"); |
| 7252 | if(NO_RECUR.deref() != null) |
| 7253 | throw new UnsupportedOperationException("Cannot recur across try"); |
| 7254 | PersistentVector args = PersistentVector.EMPTY; |
| 7255 | for(ISeq s = RT.seq(form.next()); s != null; s = s.next()) |
| 7256 | { |
| 7257 | args = args.cons(analyze(C.EXPRESSION, s.first())); |
| 7258 | } |
| 7259 | if(args.count() != loopLocals.count()) |
| 7260 | throw new IllegalArgumentException( |
| 7261 | String.format("Mismatched argument count to recur, expected: %d args, got: %d", |
| 7262 | loopLocals.count(), args.count())); |
| 7263 | for(int i = 0;i< loopLocals.count();i++) |
| 7264 | { |
| 7265 | LocalBinding lb = (LocalBinding) loopLocals.nth(i); |
| 7266 | Class primc = lb.getPrimitiveType(); |
| 7267 | if(primc != null) |
| 7268 | { |
| 7269 | boolean mismatch = false; |
| 7270 | final Class pc = maybePrimitiveType((Expr) args.nth(i)); |
| 7271 | if(primc == long.class) |
| 7272 | { |
| 7273 | if(!(pc == long.class |
| 7274 | || pc == int.class |
| 7275 | || pc == short.class |
| 7276 | || pc == char.class |
| 7277 | || pc == byte.class)) |
| 7278 | mismatch = true; |
| 7279 | } |
| 7280 | else if(primc == double.class) |
| 7281 | { |
| 7282 | if(!(pc == double.class |
| 7283 | || pc == float.class)) |
| 7284 | mismatch = true; |
| 7285 | } |
| 7286 | if(mismatch) |
| 7287 | { |
| 7288 | lb.recurMistmatch = true; |
| 7289 | if(RT.booleanCast(RT.WARN_ON_REFLECTION.deref())) |
| 7290 | RT.errPrintWriter().println |
| 7291 | (source + ":" + line + |
| 7292 | " recur arg for primitive local: " + |
| 7293 | lb.name + " is not matching primitive, had: " + |
| 7294 | (pc != null ? pc.getName():"Object") + |
| 7295 | ", needed: " + |
nothing calls this directly
no test coverage detected