@@ -256,6 +256,8 @@ public class Compiler implements Opcodes {
256
256
257
257
// DynamicClassLoader
258
258
static final public Var LOADER = Var .create ().setDynamic ();
259
+
260
+ static final public Var NEXT_ID = Var .create (new Atom (1 )).setDynamic ();
259
261
260
262
// String
261
263
static final public Var SOURCE = Var .intern (
@@ -323,6 +325,13 @@ public static void emitSource(String source) {
323
325
sc .println (source );
324
326
}
325
327
}
328
+
329
+ public static int nextScopedID () {
330
+ Atom n = (Atom ) NEXT_ID .deref ();
331
+ Integer i = (Integer ) n .deref ();
332
+ n .reset (i +1 );
333
+ return i ;
334
+ }
326
335
327
336
public static void emitSource () {
328
337
SourceWriter sc = (SourceWriter ) SOURCE_WRITER .deref ();
@@ -4336,9 +4345,9 @@ static Expr parse(C context, ISeq form, String name, Object defContext) {
4336
4345
if (RT .second (form ) instanceof Symbol )
4337
4346
name = ((Symbol ) RT .second (form )).name ;
4338
4347
String simpleName = name != null ? (munge (name ).replace ("." , "_DOT_" ) + (enclosingMethod != null ? "__"
4339
- + RT . nextID ()
4348
+ + nextScopedID ()
4340
4349
: "" ))
4341
- : ("fn" + "__" + RT . nextID ());
4350
+ : ("fn" + "__" + nextScopedID ());
4342
4351
4343
4352
/*Fix CLJ-1330
4344
4353
String basename = (enclosingMethod != null ?
@@ -4374,7 +4383,7 @@ PersistentVector.EMPTY, CONSTANT_IDS, new IdentityHashMap(),
4374
4383
KEYWORDS , PersistentHashMap .EMPTY , VARS , PersistentHashMap .EMPTY ,
4375
4384
KEYWORD_CALLSITES , PersistentVector .EMPTY , PROTOCOL_CALLSITES ,
4376
4385
PersistentVector .EMPTY , VAR_CALLSITES , emptyVarCallSites (),
4377
- NO_RECUR , null ));
4386
+ NO_RECUR , null , Compiler . NEXT_ID , new Atom ( 1 ) ));
4378
4387
4379
4388
// arglist might be preceded by symbol naming this fn
4380
4389
if (RT .second (form ) instanceof Symbol ) {
@@ -8530,7 +8539,7 @@ PersistentVector.EMPTY, CONSTANT_IDS, new IdentityHashMap(),
8530
8539
KEYWORDS , PersistentHashMap .EMPTY , VARS , PersistentHashMap .EMPTY ,
8531
8540
KEYWORD_CALLSITES , PersistentVector .EMPTY , PROTOCOL_CALLSITES ,
8532
8541
PersistentVector .EMPTY , VAR_CALLSITES , emptyVarCallSites (),
8533
- NO_RECUR , null ));
8542
+ NO_RECUR , null , Compiler . NEXT_ID , new Atom ( 1 ) ));
8534
8543
if (ret .isDeftype ()) {
8535
8544
Var .pushThreadBindings (RT .mapUniqueKeys (METHOD , null , LOCAL_ENV ,
8536
8545
ret .fields , COMPILE_STUB_SYM , Symbol .intern (null , tagName ),
0 commit comments