fix: 70% test suite pass rate (164/233)
Emitter: iterative worklist-based form processing (no more stack overflow), type conversion functions (float/int/double/long/short/byte/boolean), metadata stripping in def/defn/defn-, to-array runtime mapping Macros: namespace-qualified macro resolution (t/deftest -> deftest), when-var-exists macro restored, are/testing/is/thrown? built-in macros Runtime: cljToFloat, cljToInt, cljToBool, cljToArray conversion wrappers, cljVolatileBang, cljDeliver, cljDoall, cljDorun, cljDropLast, cljShuffle, cljFnil, cljIntern stubs Results: 164/233 passed (70%) clojure.string: 8/8 (100%) clojure.core: 156/225 (69%)
This commit is contained in:
+7
-1
@@ -88,9 +88,14 @@ proc macroexpand1*(form: CljVal): CljVal =
|
||||
if form.items.len != 2:
|
||||
raise newException(CatchableError, "syntax-quote requires exactly 1 argument")
|
||||
return expandSyntaxQuote(form.items[1])
|
||||
# Check if it's a macro
|
||||
# Check if it's a macro (try full name, then bare name without namespace prefix)
|
||||
if isMacro(name):
|
||||
return expandMacro(name, form.items[1..^1])
|
||||
let slashPos = name.find('/')
|
||||
if slashPos > 0:
|
||||
let bareName = name[slashPos+1..^1]
|
||||
if isMacro(bareName):
|
||||
return expandMacro(bareName, form.items[1..^1])
|
||||
return form
|
||||
|
||||
proc macroexpand*(form: CljVal): CljVal =
|
||||
@@ -514,6 +519,7 @@ proc initMacros*() =
|
||||
return cljList(@[cljSymbol("do")] & isForms)
|
||||
)
|
||||
|
||||
# when-var-exists: always expands body (var check is compile-time in emitter)
|
||||
defineMacro("when-var-exists", proc(args: seq[CljVal]): CljVal =
|
||||
if args.len < 2:
|
||||
raise newException(CatchableError, "when-var-exists requires symbol and body")
|
||||
|
||||
Reference in New Issue
Block a user