Implement [']

This commit is contained in:
Remko Tronçon 2019-03-11 13:41:26 +01:00
parent 5c1c33d63d
commit f17dac3e09
2 changed files with 23 additions and 0 deletions

View file

@ -1195,6 +1195,12 @@
(i32.store (i32.const !stateBase) (i32.const 0)))
(!def_word "[" "$left-bracket" !fImmediate)
;; 6.1.2510
(func $bracket-tick
(call $tick)
(call $compilePushConst (call $pop)))
(!def_word "[']" "$bracket-tick" !fImmediate)
;; 6.1.2540
(func $right-bracket
(i32.store (i32.const !stateBase) (i32.const 1)))

View file

@ -1264,6 +1264,23 @@ function loadTests(wasmModule, arrayToBase64) {
});
});
describe("[']", () => {
beforeEach(() => {
core.loadPrelude();
});
it("should work", () => {
run(': HELLO ." Hello " ;');
run(': GOODBYE ." Goodbye " ;');
run("VARIABLE 'aloha ' HELLO 'aloha !");
run(": ALOHA 'aloha @ EXECUTE ;");
run(": GOING ['] GOODBYE 'aloha ! ;");
run("GOING");
run("ALOHA");
expect(output.trim()).to.eql("Goodbye");
});
});
describe("system", () => {
beforeEach(() => {
core.loadPrelude();