| String str -> [PushString str]
| Int n when 0 <= n && n <= 0xFF -> [PushByte n]
| Int n -> [PushInt n]
+ | Block [] -> [PushUndefined]
| Block xs -> List.concat @@ interperse [Pop] @@ (List.map gen xs)
| New ((ns,name),args) ->
let qname =
| SlotSet (obj,name,value) ->
List.concat [
gen value;
- [Dup];
gen obj;
[Swap;
- SetProperty (Cpool.make_qname name); ]]
-
+ SetProperty (Cpool.make_qname name);
+ PushUndefined]]
| Ast.Call (Var name::args) when is_builtin name args ->
let inst,_ =
List.assoc name builtin in
+++ /dev/null
-(* CAUTION: this is a generated file. If you edit it, all changes will be lost! *)
-# 1 "runner.mlp"
-# 1 "<built-in>"
-# 1 "<command-line>"
-# 1 "./runner.h" 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# 1 "<command-line>" 2
-# 1 "runner.mlp"
-# 1 "runner.h" 1
-open Test_abc
-open Test_asm
-open Test_ast
-open Test_base
-open Test_bytes
-open Test_clostrans
-open Test_closuretrans
-open Test_codegen
-open Test_cpool
-open Test_hList
-open Test_lexer
-open Test_lisp
-open Test_sexp
-open Testtbl
-open Util
-# 2 "runner.mlp" 2
-
-let _ =
- Testtbl.run_test ()
GetScopeObject 1;
PushByte 42;
SetProperty (qname "x");
+ PushByte 10;
PopScope])
- (compile (LetRec (["x",Int 42],Block [])))
+ (compile (LetRec (["x",Int 42],Block [Int 10])))
test letrec =
assert_equal
GetProperty (qname "x");
SetProperty (qname "x");
+
+ PushByte 42;
PopScope])
- (compile (LetRec (["x",Var "x"],Block [])))
+ (compile (LetRec (["x",Var "x"],Block [Int 42])))
test define =
assert_equal
test slotsef =
assert_equal
(expr [PushByte 42;
- Dup;
GetLex (make_qname "obj");
Swap;
- SetProperty (make_qname "x")])
+ SetProperty (make_qname "x");
+ PushUndefined])
(generate_script @@ compile_string "(slot-set! obj x 42)")