MCPcopy Index your code
hub / github.com/clojure/clojure / CaseExpr

Method CaseExpr

src/jvm/clojure/lang/Compiler.java:9373–9401  ·  view source on GitHub ↗
(int line, int column, LocalBindingExpr expr, int shift, int mask, int low, int high, Expr defaultExpr,
	        SortedMap<Integer,Expr> tests,HashMap<Integer,Expr> thens, Keyword switchType, Keyword testType, Set<Integer> skipCheck)

Source from the content-addressed store, hash-verified

9371 final static Keyword intKey = Keyword.intern(null, "int");
9372 //(case* expr shift mask default map<minhash, [test then]> table-type test-type skip-check?)
9373 public CaseExpr(int line, int column, LocalBindingExpr expr, int shift, int mask, int low, int high, Expr defaultExpr,
9374 SortedMap<Integer,Expr> tests,HashMap<Integer,Expr> thens, Keyword switchType, Keyword testType, Set<Integer> skipCheck){
9375 this.expr = expr;
9376 this.shift = shift;
9377 this.mask = mask;
9378 this.low = low;
9379 this.high = high;
9380 this.defaultExpr = defaultExpr;
9381 this.tests = tests;
9382 this.thens = thens;
9383 this.line = line;
9384 this.column = column;
9385 if (switchType != compactKey && switchType != sparseKey)
9386 throw new IllegalArgumentException("Unexpected switch type: "+switchType);
9387 this.switchType = switchType;
9388 if (testType != intKey && testType != hashEquivKey && testType != hashIdentityKey)
9389 throw new IllegalArgumentException("Unexpected test type: "+switchType);
9390 this.testType = testType;
9391 this.skipCheck = skipCheck;
9392 Collection<Expr> returns = new ArrayList(thens.values());
9393 returns.add(defaultExpr);
9394 this.returnType = maybeJavaClass(returns);
9395 if(RT.count(skipCheck) > 0 && RT.booleanCast(RT.WARN_ON_REFLECTION.deref()))
9396 {
9397 RT.errPrintWriter()
9398 .format("Performance warning, %s:%d:%d - hash collision of some case test constants; if selected, those entries will be tested sequentially.\n",
9399 SOURCE_PATH.deref(), line, column);
9400 }
9401 }
9402
9403 public boolean hasJavaClass(){
9404 return returnType != null;

Callers

nothing calls this directly

Calls 8

countMethod · 0.95
booleanCastMethod · 0.95
errPrintWriterMethod · 0.95
valuesMethod · 0.80
maybeJavaClassMethod · 0.80
formatMethod · 0.80
addMethod · 0.65
derefMethod · 0.65

Tested by

no test coverage detected