(C context, Object frm)
| 9597 | //case macro binds actual expr in let so expr is always a local, |
| 9598 | //no need to worry about multiple evaluation |
| 9599 | public Expr parse(C context, Object frm) { |
| 9600 | ISeq form = (ISeq) frm; |
| 9601 | if(context == C.EVAL) |
| 9602 | return analyze(context, RT.list(RT.list(FNONCE, PersistentVector.EMPTY, form))); |
| 9603 | IPersistentVector args = LazilyPersistentVector.create(form.next()); |
| 9604 | |
| 9605 | Object exprForm = args.nth(0); |
| 9606 | int shift = ((Number)args.nth(1)).intValue(); |
| 9607 | int mask = ((Number)args.nth(2)).intValue(); |
| 9608 | Object defaultForm = args.nth(3); |
| 9609 | Map caseMap = (Map)args.nth(4); |
| 9610 | Keyword switchType = ((Keyword)args.nth(5)); |
| 9611 | Keyword testType = ((Keyword)args.nth(6)); |
| 9612 | Set skipCheck = RT.count(args) < 8 ? null : (Set)args.nth(7); |
| 9613 | |
| 9614 | ISeq keys = RT.keys(caseMap); |
| 9615 | int low = ((Number)RT.first(keys)).intValue(); |
| 9616 | int high = ((Number)RT.nth(keys, RT.count(keys)-1)).intValue(); |
| 9617 | |
| 9618 | LocalBindingExpr testexpr = (LocalBindingExpr) analyze(C.EXPRESSION, exprForm); |
| 9619 | testexpr.shouldClear = false; |
| 9620 | |
| 9621 | SortedMap<Integer,Expr> tests = new TreeMap(); |
| 9622 | HashMap<Integer,Expr> thens = new HashMap(); |
| 9623 | |
| 9624 | PathNode branch = new PathNode(PATHTYPE.BRANCH, (PathNode) CLEAR_PATH.get()); |
| 9625 | |
| 9626 | for(Object o : caseMap.entrySet()) |
| 9627 | { |
| 9628 | Map.Entry e = (Map.Entry) o; |
| 9629 | Integer minhash = ((Number)e.getKey()).intValue(); |
| 9630 | Object pair = e.getValue(); // [test-val then-expr] |
| 9631 | Expr testExpr = testType == intKey |
| 9632 | ? NumberExpr.parse(((Number)RT.first(pair)).intValue()) |
| 9633 | : new ConstantExpr(RT.first(pair)); |
| 9634 | tests.put(minhash, testExpr); |
| 9635 | |
| 9636 | Expr thenExpr; |
| 9637 | try { |
| 9638 | Var.pushThreadBindings( |
| 9639 | RT.map(CLEAR_PATH, new PathNode(PATHTYPE.PATH,branch))); |
| 9640 | thenExpr = analyze(context, RT.second(pair)); |
| 9641 | } |
| 9642 | finally{ |
| 9643 | Var.popThreadBindings(); |
| 9644 | } |
| 9645 | thens.put(minhash, thenExpr); |
| 9646 | } |
| 9647 | |
| 9648 | Expr defaultExpr; |
| 9649 | try { |
| 9650 | Var.pushThreadBindings( |
| 9651 | RT.map(CLEAR_PATH, new PathNode(PATHTYPE.PATH,branch))); |
| 9652 | defaultExpr = analyze(context, args.nth(3)); |
| 9653 | } |
| 9654 | finally{ |
| 9655 | Var.popThreadBindings(); |
| 9656 | } |
nothing calls this directly
no test coverage detected