-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) test262: don't output to stderr for unrelated errors
This should fix some incorrectly wrongly failing tests on https://test262.fyi
- Loading branch information
1 parent
e9c4303
commit 851f06b
Showing
14 changed files
with
180 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
!*/ | ||
!LICENSE | ||
|
||
success.txt | ||
failed.txt | ||
balde | ||
*.out | ||
*.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import std/[importutils, strutils] | ||
import mirage/runtime/prelude | ||
import bali/runtime/types | ||
import bali/internal/sugar | ||
|
||
privateAccess(PulsarInterpreter) | ||
|
||
type | ||
JSException* = ref object of RuntimeException | ||
name: string = "" | ||
|
||
DeathCallback* = proc(vm: PulsarInterpreter, exitCode: int = 1) | ||
|
||
proc DefaultDeathCallback(vm: PulsarInterpreter, exitCode: int = 1) = | ||
quit(exitCode) | ||
|
||
var deathCallback*: DeathCallback = DefaultDeathCallback | ||
|
||
proc generateMessage*(exc: JSException, err: string): string = | ||
var msg = "Uncaught " | ||
|
||
if exc.name.len > 0: | ||
msg &= exc.name & ':' | ||
|
||
msg & err | ||
|
||
proc jsException*(msg: string): JSException {.inline.} = | ||
var exc = JSException() | ||
exc.message = exc.generateMessage(msg) | ||
|
||
exc | ||
|
||
proc logTracebackAndDie*(runtime: Runtime, exitCode: int = 1) = | ||
let traceback = runtime.vm.generateTraceback() | ||
assert *traceback, "Mirage failed to generate traceback!" | ||
|
||
if runtime.vm.trace.exception.message.contains(runtime.test262.negative.`type`): | ||
stdout.write(&traceback & '\n') | ||
deathCallback(runtime.vm, exitCode) | ||
else: | ||
stderr.write &traceback & '\n' | ||
deathCallback(runtime.vm, exitCode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Implementation of the error throw IR builtin | ||
## Refactored here because Nim hates me | ||
## Authors: | ||
## Trayambak Rai (xtrayambak at disroot dot org) | ||
import std/[logging] | ||
import mirage/runtime/prelude | ||
import bali/stdlib/errors_common | ||
import bali/runtime/[arguments, atom_helpers, types] | ||
import bali/runtime/abstract/to_string | ||
import bali/internal/sugar | ||
|
||
proc generateStdIr*(runtime: Runtime) = | ||
info "errors: generate IR interface" | ||
|
||
runtime.vm.registerBuiltin( | ||
"BALI_THROWERROR", | ||
proc(op: Operation) = | ||
let atom = runtime.argument(1, required = true, message = "BUG: BALI_THROWERROR got {nargs} atoms, expected one!") | ||
runtime.vm.throw(jsException( | ||
runtime.ToString(&atom) | ||
)) | ||
runtime.logTracebackAndDie(), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import ./[console, math, uri, errors, json, constants, date] | ||
import ./[console, math, uri, errors, errors_ir, errors_common, json, constants, date] | ||
import ./builtins/[base64, parse_int, test262, encode_uri] | ||
|
||
export console, math, uri, parse_int, errors, test262, base64, json, constants, date, | ||
encode_uri | ||
encode_uri, errors_ir, errors_common |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.