OSDN Git Service

add test-case
authorMIZUNO Hiroki <mzpppp@gmail.com>
Mon, 26 May 2008 00:04:55 +0000 (09:04 +0900)
committerMIZUNO Hiroki <mzpppp@gmail.com>
Mon, 26 May 2008 00:04:55 +0000 (09:04 +0900)
test/test_ast.ml
test/test_lisp.ml
util/instruction.txt

index e88415f..b8b2890 100644 (file)
@@ -65,3 +65,8 @@ test let_ =
             GetProperty (QName ((Namespace ""),"1"));
             PopScope])
     (compile (Let (["x",Int 1;"y",Int 2],Block [Var "x";Var "y"])))
+
+test call =
+  assert_equal 
+    (result [NewFunction (result [PushInt 42]) ])
+    (compile (Method ("",Block [Int 42])))
index a4a1e8c..a7a4e9e 100644 (file)
@@ -45,3 +45,6 @@ test begin_ =
     assert_equal [Block [Int 1;Int 2]] @@
       compile_string "(begin 1 2)"
       
+test lammda =
+    assert_equal [Method ("",Block [Int 42])] @@
+      compile_string "(lambda () 42)"
index 4443ffe..481d04b 100644 (file)
@@ -58,6 +58,7 @@ SetGlobalSlot of int:op=0x6f; stack= ~-1; args=const [u30 arg0]
 GetProperty of Cpool.multiname: op=0x66; const=multiname arg0; args=fun (cmap,_) ->[multiname_get arg0 cmap]
 
 ReturnVoid: op=0x47
+ReturnValue: op=0x48; stack= ~-1
 FindPropStrict of Cpool.multiname: op=0x5D; stack=1; const=multiname arg0; args=fun (cmap,_) ->[multiname_get arg0 cmap]
 PushUInt of int: op=0x2E; stack=1; const=uint arg0; args=fun (cmap,_) -> [uint_get arg0 cmap]
 CallPropLex of Cpool.multiname * int: op=0x4c; stack= 1-arg1; args=fun (cmap,_) ->[multiname_get arg0 cmap;Bytes.u30 arg1]