diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-05-19 23:32:16 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-05-19 23:32:16 -0700 |
commit | 64d3e8e2e0599c11dd4b38836e7f346c5bb7c5db (patch) | |
tree | 89b311f44d22cab65a4e2e27c19ea1c36748877e | |
parent | 119e661f20c0b4d9d82cad3cd26b42a947a68521 (diff) | |
download | mu-64d3e8e2e0599c11dd4b38836e7f346c5bb7c5db.tar.gz |
.
-rw-r--r-- | shell/evaluate.mu | 3 | ||||
-rw-r--r-- | shell/macroexpand.mu | 13 |
2 files changed, 13 insertions, 3 deletions
diff --git a/shell/evaluate.mu b/shell/evaluate.mu index 714e4255..2b8cded0 100644 --- a/shell/evaluate.mu +++ b/shell/evaluate.mu @@ -17,9 +17,6 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han } # errors? skip { - var should-trace?/eax: boolean <- should-trace? trace - compare should-trace?, 0/false - break-if-= var error?/eax: boolean <- has-errors? trace compare error?, 0/false break-if-= diff --git a/shell/macroexpand.mu b/shell/macroexpand.mu index 83c3c025..2915bc26 100644 --- a/shell/macroexpand.mu +++ b/shell/macroexpand.mu @@ -16,6 +16,9 @@ fn macroexpand expr-ah: (addr handle cell), globals: (addr global-table), trace: # }}} # loop until convergence { + var error?/eax: boolean <- has-errors? trace + compare error?, 0/false + break-if-!= var expanded?/eax: boolean <- macroexpand-iter expr-ah, globals, trace compare expanded?, 0/false loop-if-!= @@ -119,6 +122,13 @@ fn macroexpand-iter _expr-ah: (addr handle cell), globals: (addr global-table), var curr-ah/eax: (addr handle cell) <- get rest, left var macro-found?/eax: boolean <- macroexpand-iter curr-ah, globals, trace result <- or macro-found? + { + var error?/eax: boolean <- has-errors? trace + compare error?, 0/false + break-if-= + trace-higher trace + return result + } loop } trace-higher trace @@ -217,6 +227,9 @@ fn macroexpand-iter _expr-ah: (addr handle cell), globals: (addr global-table), #? dump-trace trace var macro-found?/eax: boolean <- macroexpand-iter curr-ah, globals, trace result <- or macro-found? + var error?/eax: boolean <- has-errors? trace + compare error?, 0/false + break-if-!= var rest/eax: (addr cell) <- lookup *rest-ah { var nil?/eax: boolean <- nil? rest |