@@ -55,13 +55,17 @@ internal static Type FindDuplicateType(string typename)
5555 _evalTypeMap . TryGetValue ( typename , out Type type ) ;
5656 return type ;
5757 }
58+
59+ internal static Type FindDuplicateCompiledType ( string typename ) => null ;
60+
5861#else
5962 internal static void RegisterDuplicateType ( Type type )
6063 {
6164 if ( Compiler . IsCompiling )
6265 _compilerTypeMap [ type . FullName ] = type ;
6366 else
6467 _evalTypeMap [ type . FullName ] = type ;
68+ Console . WriteLine ( $ "Register { type . FullName } , isCompilning = { Compiler . IsCompiling } ") ;
6569 }
6670
6771 internal static Type FindDuplicateType ( string typename )
@@ -72,6 +76,15 @@ internal static Type FindDuplicateType(string typename)
7276 _evalTypeMap . TryGetValue ( typename , out Type type ) ;
7377 return type ;
7478 }
79+
80+ internal static Type FindDuplicateCompiledType ( string typename )
81+ {
82+ if ( _compilerTypeMap . TryGetValue ( typename , out Type compiledType ) )
83+ return compiledType ;
84+ else
85+ return null ;
86+ }
87+
7588#endif
7689
7790 #endregion
@@ -107,6 +120,8 @@ internal static Type FindDuplicateType(string typename)
107120 public static readonly Symbol ReifySym = Symbol . intern ( "reify*" ) ;
108121 public static readonly Symbol AmpersandSym = Symbol . intern ( "&" ) ;
109122
123+ public static readonly Symbol ParseEvalSym = Symbol . intern ( "parse-eval*" ) ;
124+
110125 public static readonly Symbol IdentitySym = Symbol . intern ( "clojure.core" , "identity" ) ;
111126
112127 static readonly Symbol NsSym = Symbol . intern ( "ns" ) ;
@@ -301,7 +316,8 @@ public static object ElideMeta(object m)
301316 CatchSym , null ,
302317 FinallySym , null ,
303318 NewSym , new NewExpr . Parser ( ) ,
304- AmpersandSym , null
319+ AmpersandSym , null ,
320+ ParseEvalSym , new ParseEvalExpr . Parser ( )
305321 ) ;
306322
307323 public static bool IsSpecial ( Object sym )
@@ -620,7 +636,7 @@ private static object ResolveIn(Namespace n, Symbol symbol, bool allowPrivate)
620636 public static object maybeResolveIn ( Namespace n , Symbol symbol )
621637 {
622638 // note: ns-qualified vars must already exist
623- if ( symbol . Namespace != null )
639+ if ( symbol . Namespace != null )
624640 {
625641 Namespace ns = namespaceFor ( n , symbol ) ;
626642 if ( ns == null )
@@ -641,7 +657,16 @@ public static object maybeResolveIn(Namespace n, Symbol symbol)
641657 else
642658 {
643659 object o = n . GetMapping ( symbol ) ;
660+ if ( o is Type type )
661+ {
662+ var tName = type . FullName ;
663+ var compiledType = Compiler . FindDuplicateCompiledType ( tName ) ;
664+ if ( compiledType is not null && Compiler . IsCompiling )
665+ return compiledType ;
666+ }
667+
644668 return o ;
669+
645670 }
646671 }
647672
0 commit comments