Skip to content

Commit d9e6995

Browse files
committed
[Analyzer, Conf] Handle V8 native syntax
1 parent fd76cc8 commit d9e6995

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

conf/V8.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"engine": "V8",
33
"timeout": 30,
44
"engine_path": "/path/to/v8",
5-
"argv": [],
5+
"argv": ["--expose-gc", "--allow-natives-syntax"],
66
"env": { },
77
"seed_path": "/path/to/seed",
88
"preproc_dir": "/path/to/pre",
@@ -21,13 +21,13 @@
2121
"unescape", "eval", "isFinite", "isNaN", "print", "printErr", "write",
2222
"read", "readbuffer", "readline", "load", "setTimeout", "quit",
2323
"testRunner", "version", "Realm", "performance", "Worker",
24-
"SharedArrayBuffer", "Atomics", "BigInt", "WebAssembly"
24+
"SharedArrayBuffer", "Atomics", "BigInt", "WebAssembly", "gc"
2525
],
2626
"filters": [
2727
"load", "assert", "eval", "shouldBeFalse", "shouldNotThrow", "shouldBe",
2828
"shouldBeNull", "shouldBeUndefined", "shouldThrow", "shouldBeTrue",
2929
"shouldBeEqualToString", "crash" , "$ERROR", "Test", "tryItOut", "WScript",
30-
"Function", "read", "readbuffer", "readline", "console"
30+
"Function", "read", "readbuffer", "readline", "console", "%AbortJS"
3131
],
3232
"jobs": 56
3333
}

src/Analyzer/CodeBrick.fs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@ type Context = {
3535
}
3636

3737
module Context =
38+
let mkIsBuiltIn conf =
39+
let lists = conf.BuiltIns
40+
match conf.Engine with
41+
| V8 -> (fun x -> (Array.includes lists x) || (x.StartsWith ("%")))
42+
| _ -> Array.includes lists
43+
3844
let init conf = {
3945
Pool = Map.empty
4046
GuardMap = Map.empty
41-
IsBuiltIn = Array.includes conf.BuiltIns
47+
IsBuiltIn = mkIsBuiltIn conf
4248
IsFilters =
4349
(fun x -> Map.foranyKeys (Array.includes conf.Filters) x.NSymMap)
4450
}

0 commit comments

Comments
 (0)