Skip to content

Commit 48e3292

Browse files
foguspuredanger
authored andcommitted
CLJ-2712: Revert "fix AOT bug preventing overriding of clojure.core functions"
This reverts commit 59889fd. Existing code handles the condition where a namespace mapping shadows an existing core name but does not handle the case where a var will shadow a future core var. New code to handle all cases is available in CLJ-2711.
1 parent 56d3799 commit 48e3292

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

src/jvm/clojure/lang/Compiler.java

+2-19
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ static class DefExpr implements Expr{
410410
public final Expr meta;
411411
public final boolean initProvided;
412412
public final boolean isDynamic;
413-
public final boolean shadowsCoreMapping;
414413
public final String source;
415414
public final int line;
416415
public final int column;
@@ -419,17 +418,15 @@ static class DefExpr implements Expr{
419418
final static Method setMetaMethod = Method.getMethod("void setMeta(clojure.lang.IPersistentMap)");
420419
final static Method setDynamicMethod = Method.getMethod("clojure.lang.Var setDynamic(boolean)");
421420
final static Method symintern = Method.getMethod("clojure.lang.Symbol intern(String, String)");
422-
final static Method internVar = Method.getMethod("clojure.lang.Var refer(clojure.lang.Symbol, clojure.lang.Var)");
423421

424-
public DefExpr(String source, int line, int column, Var var, Expr init, Expr meta, boolean initProvided, boolean isDynamic, boolean shadowsCoreMapping){
422+
public DefExpr(String source, int line, int column, Var var, Expr init, Expr meta, boolean initProvided, boolean isDynamic){
425423
this.source = source;
426424
this.line = line;
427425
this.column = column;
428426
this.var = var;
429427
this.init = init;
430428
this.meta = meta;
431429
this.isDynamic = isDynamic;
432-
this.shadowsCoreMapping = shadowsCoreMapping;
433430
this.initProvided = initProvided;
434431
}
435432

@@ -475,18 +472,6 @@ public Object eval() {
475472

476473
public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
477474
objx.emitVar(gen, var);
478-
479-
if (shadowsCoreMapping)
480-
{
481-
gen.dup();
482-
gen.getField(VAR_TYPE, "ns", NS_TYPE);
483-
gen.swap();
484-
gen.dup();
485-
gen.getField(VAR_TYPE, "sym", SYMBOL_TYPE);
486-
gen.swap();
487-
gen.invokeVirtual(NS_TYPE, internVar);
488-
}
489-
490475
if(isDynamic)
491476
{
492477
gen.push(isDynamic);
@@ -544,13 +529,11 @@ else if(!(RT.second(form) instanceof Symbol))
544529
Var v = lookupVar(sym, true);
545530
if(v == null)
546531
throw Util.runtimeException("Can't refer to qualified var that doesn't exist");
547-
boolean shadowsCoreMapping = false;
548532
if(!v.ns.equals(currentNS()))
549533
{
550534
if(sym.ns == null)
551535
{
552536
v = currentNS().intern(sym);
553-
shadowsCoreMapping = true;
554537
registerVar(v);
555538
}
556539
// throw Util.runtimeException("Name conflict, can't def " + sym + " because namespace: " + currentNS().name +
@@ -594,7 +577,7 @@ else if(!(RT.second(form) instanceof Symbol))
594577
Expr meta = mm.count()==0 ? null:analyze(context == C.EVAL ? context : C.EXPRESSION, mm);
595578
return new DefExpr((String) SOURCE.deref(), lineDeref(), columnDeref(),
596579
v, analyze(context == C.EVAL ? context : C.EXPRESSION, RT.third(form), v.sym.name),
597-
meta, RT.count(form) == 3, isDynamic, shadowsCoreMapping);
580+
meta, RT.count(form) == 3, isDynamic);
598581
}
599582
}
600583
}

0 commit comments

Comments
 (0)