@@ -2376,53 +2376,8 @@ def _resolve_nested_symbol(ctx: AnalyzerContext, form: sym.Symbol) -> HostField:
2376
2376
)
2377
2377
2378
2378
2379
- def __fuzzy_resolve_namespace_reference (
2380
- ctx : AnalyzerContext , which_ns : runtime .Namespace , form : sym .Symbol
2381
- ) -> Optional [VarRef ]:
2382
- """Resolve a symbol within `which_ns` based on any namespaces required or otherwise
2383
- referenced within `which_ns` (e.g. by a :refer).
2384
-
2385
- When a required or resolved symbol is read by the reader in the context of a syntax
2386
- quote, the reader will fully resolve the symbol, so a symbol like `set/union` would be
2387
- expanded to `basilisp.set/union`. However, the namespace still does not maintain a
2388
- direct mapping of the symbol `basilisp.set` to the namespace it names, since the
2389
- namespace was required as `[basilisp.set :as set]`.
2390
-
2391
- During macroexpansion, the Analyzer needs to resolve these transitive requirements,
2392
- so we 'fuzzy' resolve against any namespaces known to the current macro namespace."""
2393
- assert form .ns is not None
2394
- ns_name = form .ns
2395
-
2396
- def resolve_ns_reference (
2397
- ns_map : Mapping [str , runtime .Namespace ]
2398
- ) -> Optional [VarRef ]:
2399
- match : Optional [runtime .Namespace ] = ns_map .get (ns_name )
2400
- if match is not None :
2401
- v = match .find (sym .symbol (form .name ))
2402
- if v is not None :
2403
- return VarRef (
2404
- form = form , var = v , env = ctx .get_node_env (pos = ctx .syntax_position ),
2405
- )
2406
- return None
2407
-
2408
- # Try to match a required namespace
2409
- required_namespaces = {ns .name : ns for ns in which_ns .aliases .values ()}
2410
- match = resolve_ns_reference (required_namespaces )
2411
- if match is not None :
2412
- return match
2413
-
2414
- # Try to match a referred namespace
2415
- referred_namespaces = {
2416
- ns .name : ns for ns in {var .ns for var in which_ns .refers .values ()}
2417
- }
2418
- return resolve_ns_reference (referred_namespaces )
2419
-
2420
-
2421
2379
def __resolve_namespaced_symbol_in_ns ( # pylint: disable=too-many-branches
2422
- ctx : AnalyzerContext ,
2423
- which_ns : runtime .Namespace ,
2424
- form : sym .Symbol ,
2425
- allow_fuzzy_macroexpansion_matching : bool = False ,
2380
+ ctx : AnalyzerContext , which_ns : runtime .Namespace , form : sym .Symbol ,
2426
2381
) -> Optional [Union [MaybeHostForm , VarRef ]]:
2427
2382
"""Resolve the symbol `form` in the context of the Namespace `which_ns`. If
2428
2383
`allow_fuzzy_macroexpansion_matching` is True and no match is made on existing
@@ -2432,14 +2387,6 @@ def __resolve_namespaced_symbol_in_ns( # pylint: disable=too-many-branches
2432
2387
2433
2388
ns_sym = sym .symbol (form .ns )
2434
2389
if ns_sym in which_ns .imports or ns_sym in which_ns .import_aliases :
2435
- # We still import Basilisp code, so we'll want to make sure
2436
- # that the symbol isn't referring to a Basilisp Var first
2437
- v = Var .find (form )
2438
- if v is not None :
2439
- return VarRef (
2440
- form = form , var = v , env = ctx .get_node_env (pos = ctx .syntax_position ),
2441
- )
2442
-
2443
2390
# Fetch the full namespace name for the aliased namespace/module.
2444
2391
# We don't need this for actually generating the link later, but
2445
2392
# we _do_ need it for fetching a reference to the module to check
@@ -2491,8 +2438,6 @@ def __resolve_namespaced_symbol_in_ns( # pylint: disable=too-many-branches
2491
2438
form = form ,
2492
2439
)
2493
2440
return VarRef (form = form , var = v , env = ctx .get_node_env (pos = ctx .syntax_position ),)
2494
- elif allow_fuzzy_macroexpansion_matching :
2495
- return __fuzzy_resolve_namespace_reference (ctx , which_ns , form )
2496
2441
2497
2442
return None
2498
2443
@@ -2550,12 +2495,6 @@ def __resolve_namespaced_symbol( # pylint: disable=too-many-branches
2550
2495
resolved = __resolve_namespaced_symbol_in_ns (ctx , current_ns , form )
2551
2496
if resolved is not None :
2552
2497
return resolved
2553
- elif ctx .current_macro_ns is not None :
2554
- resolved = __resolve_namespaced_symbol_in_ns (
2555
- ctx , ctx .current_macro_ns , form , allow_fuzzy_macroexpansion_matching = True
2556
- )
2557
- if resolved is not None :
2558
- return resolved
2559
2498
2560
2499
if "." in form .ns :
2561
2500
try :
@@ -2834,8 +2773,6 @@ def _analyze_form( # pylint: disable=too-many-branches
2834
2773
if form == llist .List .empty ():
2835
2774
with ctx .quoted ():
2836
2775
return _const_node (ctx , form )
2837
- elif ctx .is_quoted :
2838
- return _const_node (ctx , form )
2839
2776
else :
2840
2777
return _list_node (ctx , form )
2841
2778
elif isinstance (form , vec .Vector ):
0 commit comments