Skip to content

Commit

Permalink
feat(hog): lambdas and callable refactor (#24595)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra authored Aug 28, 2024
1 parent 1927d8d commit be9c065
Show file tree
Hide file tree
Showing 44 changed files with 2,684 additions and 661 deletions.
22 changes: 11 additions & 11 deletions hogvm/__tests__/__snapshots__/catch.hoge
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
["_H", 1, 41, "FishError", 1, 9, 32, "FishError", 36, 0, 31, 2, "HogError", 3, 38, 41, "FoodError", 1, 9, 32,
"FoodError", 36, 0, 31, 2, "HogError", 3, 38, 50, 10, 32, "You forgot to feed your fish", 2, "FishError", 1, 49, 51, 39,
55, 36, 0, 32, "type", 45, 32, "FoodError", 36, 1, 11, 40, 16, 32, "Problem with your food: ", 36, 0, 32, "message", 45,
2, "concat", 2, 2, "print", 1, 35, 39, 25, 32, "FishError", 36, 1, 11, 40, 16, 32, "Problem with your fish: ", 36, 0,
32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 50, 10, 32, "Your fish are hungry", 2,
"FoodError", 1, 49, 51, 39, 55, 36, 0, 32, "type", 45, 32, "FoodError", 36, 1, 11, 40, 16, 32,
"Problem with your food: ", 36, 0, 32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 25, 32, "FishError", 36, 1,
11, 40, 16, 32, "Problem with your fish: ", 36, 0, 32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49,
35, 35, 50, 11, 32, "Your fish are hungry", 31, 2, "NotImplementedError", 2, 49, 51, 39, 45, 36, 0, 32, "type", 45, 32,
"FoodError", 36, 1, 11, 40, 16, 32, "Problem with your food: ", 36, 0, 32, "message", 45, 2, "concat", 2, 2, "print", 1,
35, 39, 15, 32, "Unknown problem: ", 36, 0, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35]
["_H", 1, 52, "FishError", 1, 0, 8, 32, "FishError", 36, 0, 2, "HogError", 2, 38, 53, 0, 52, "FoodError", 1, 0, 8, 32,
"FoodError", 36, 0, 2, "HogError", 2, 38, 53, 0, 50, 11, 32, "You forgot to feed your fish", 36, 0, 54, 1, 49, 51, 39,
55, 36, 2, 32, "type", 45, 32, "FoodError", 36, 3, 11, 40, 16, 32, "Problem with your food: ", 36, 2, 32, "message", 45,
2, "concat", 2, 2, "print", 1, 35, 39, 25, 32, "FishError", 36, 3, 11, 40, 16, 32, "Problem with your fish: ", 36, 2,
32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 50, 11, 32, "Your fish are hungry", 36, 1,
54, 1, 49, 51, 39, 55, 36, 2, 32, "type", 45, 32, "FoodError", 36, 3, 11, 40, 16, 32, "Problem with your food: ", 36, 2,
32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 25, 32, "FishError", 36, 3, 11, 40, 16, 32,
"Problem with your fish: ", 36, 2, 32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 50, 10,
32, "Your fish are hungry", 2, "NotImplementedError", 1, 49, 51, 39, 45, 36, 2, 32, "type", 45, 32, "FoodError", 36, 3,
11, 40, 16, 32, "Problem with your food: ", 36, 2, 32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 15, 32,
"Unknown problem: ", 36, 2, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 35, 35]
26 changes: 13 additions & 13 deletions hogvm/__tests__/__snapshots__/catch2.hoge
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
["_H", 1, 50, 50, 50, 13, 32, "FishError", 32, "You forgot to feed your fish", 31, 2, "HogError", 3, 49, 51, 39, 32, 36,
0, 32, "type", 45, 32, "FoodError", 36, 1, 11, 40, 16, 32, "Problem with your food: ", 36, 0, 32, "message", 45, 2,
["_H", 1, 50, 49, 50, 12, 32, "FishError", 32, "You forgot to feed your fish", 2, "HogError", 2, 49, 51, 39, 32, 36, 0,
32, "type", 45, 32, "FoodError", 36, 1, 11, 40, 16, 32, "Problem with your food: ", 36, 0, 32, "message", 45, 2,
"concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 51, 39, 48, 36, 0, 32, "type", 45, 32, "FishError", 36, 1, 11,
40, 16, 32, "FishError: ", 36, 0, 32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 18, 32, "Error: ", 36, 0,
32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 50, 50, 50, 13, 32, "FunkyError", 32,
"You forgot to feed your fish", 31, 2, "HogError", 3, 49, 51, 39, 32, 36, 0, 32, "type", 45, 32, "FoodError", 36, 1, 11,
40, 16, 32, "Problem with your food: ", 36, 0, 32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35,
35, 51, 39, 55, 36, 0, 32, "type", 45, 32, "FishError", 36, 1, 11, 40, 16, 32, "FishError: ", 36, 0, 32, "message", 45,
2, "concat", 2, 2, "print", 1, 35, 39, 25, 32, "Error of type ", 36, 0, 32, "name", 45, 32, ": ", 36, 0, 32, "message",
45, 2, "concat", 4, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 50, 50, 50, 13, 32, "FishError", 32,
"You forgot to feed your fish", 31, 2, "HogError", 3, 49, 51, 39, 32, 36, 0, 32, "type", 45, 32, "FoodError", 36, 1, 11,
40, 16, 32, "Problem with your food: ", 36, 0, 32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35,
35, 51, 39, 55, 36, 0, 32, "type", 45, 32, "Error of type ", 36, 0, 32, "name", 45, 32, ": ", 36, 0, 32, "message", 45,
2, "concat", 4, 2, "print", 1, 35, 39, 25, 32, "FishError", 36, 1, 11, 40, 16, 32, "FishError: ", 36, 0, 32, "message",
45, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35]
32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 50, 49, 50, 12, 32, "FunkyError", 32,
"You forgot to feed your fish", 2, "HogError", 2, 49, 51, 39, 32, 36, 0, 32, "type", 45, 32, "FoodError", 36, 1, 11, 40,
16, 32, "Problem with your food: ", 36, 0, 32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35,
51, 39, 55, 36, 0, 32, "type", 45, 32, "FishError", 36, 1, 11, 40, 16, 32, "FishError: ", 36, 0, 32, "message", 45, 2,
"concat", 2, 2, "print", 1, 35, 39, 25, 32, "Error of type ", 36, 0, 32, "name", 45, 32, ": ", 36, 0, 32, "message", 45,
2, "concat", 4, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 50, 49, 50, 12, 32, "FishError", 32,
"You forgot to feed your fish", 2, "HogError", 2, 49, 51, 39, 32, 36, 0, 32, "type", 45, 32, "FoodError", 36, 1, 11, 40,
16, 32, "Problem with your food: ", 36, 0, 32, "message", 45, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35,
51, 39, 55, 36, 0, 32, "type", 45, 32, "Error of type ", 36, 0, 32, "name", 45, 32, ": ", 36, 0, 32, "message", 45, 2,
"concat", 4, 2, "print", 1, 35, 39, 25, 32, "FishError", 36, 1, 11, 40, 16, 32, "FishError: ", 36, 0, 32, "message", 45,
2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35]
19 changes: 10 additions & 9 deletions hogvm/__tests__/__snapshots__/exceptions.hoge
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
0, 32, " was the exception", 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 32, "------------------", 2,
"print", 1, 35, 32, "start", 2, "print", 1, 35, 50, 10, 32, "try", 2, "print", 1, 35, 51, 39, 17, 36, 0, 32, "type", 45,
32, "No var for error, but no error", 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 32, "------------------", 2, "print", 1,
35, 50, 16, 32, "try again", 2, "print", 1, 35, 31, 31, 2, "Error", 2, 49, 51, 39, 22, 36, 0, 32, "type", 45, 36, 0, 32,
35, 50, 14, 32, "try again", 2, "print", 1, 35, 2, "Error", 0, 49, 51, 39, 22, 36, 0, 32, "type", 45, 36, 0, 32,
" was the exception", 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 32, "------------------", 2, "print", 1,
35, 50, 16, 32, "try again", 2, "print", 1, 35, 31, 31, 2, "Error", 2, 49, 51, 39, 17, 36, 0, 32, "type", 45, 32,
"No var for error", 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 32, "------------------", 2, "print", 1, 35, 41, "third",
0, 15, 32, "Throwing in third", 2, "print", 1, 35, 32, "Threw in third", 31, 2, "Error", 2, 49, 31, 38, 41, "second", 0,
12, 32, "second", 2, "print", 1, 35, 2, "third", 0, 35, 31, 38, 41, "first", 0, 12, 32, "first", 2, "print", 1, 35, 2,
"second", 0, 35, 31, 38, 41, "base", 0, 42, 32, "base", 2, "print", 1, 35, 50, 8, 2, "first", 0, 35, 51, 39, 25, 36, 0,
32, "type", 45, 32, "Caught in base: ", 36, 0, 2, "concat", 2, 2, "print", 1, 35, 36, 0, 49, 39, 2, 35, 49, 35, 35, 31,
38, 50, 8, 2, "base", 0, 35, 51, 39, 22, 36, 0, 32, "type", 45, 32, "Caught in root: ", 36, 0, 2, "concat", 2, 2,
"print", 1, 35, 39, 2, 35, 49, 35, 35, 32, "The end", 2, "print", 1, 35]
35, 50, 14, 32, "try again", 2, "print", 1, 35, 2, "Error", 0, 49, 51, 39, 17, 36, 0, 32, "type", 45, 32,
"No var for error", 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 32, "------------------", 2, "print", 1, 35, 52, "third",
0, 0, 14, 32, "Throwing in third", 2, "print", 1, 35, 32, "Threw in third", 2, "Error", 1, 49, 31, 38, 53, 0, 52,
"second", 0, 1, 13, 32, "second", 2, "print", 1, 35, 55, 0, 54, 0, 35, 31, 38, 53, 1, true, 0, 52, "first", 0, 1, 13,
32, "first", 2, "print", 1, 35, 55, 0, 54, 0, 35, 31, 38, 53, 1, true, 1, 52, "base", 0, 1, 43, 32, "base", 2, "print",
1, 35, 50, 9, 55, 0, 54, 0, 35, 51, 39, 25, 36, 0, 32, "type", 45, 32, "Caught in base: ", 36, 0, 2, "concat", 2, 2,
"print", 1, 35, 36, 0, 49, 39, 2, 35, 49, 35, 35, 31, 38, 53, 1, true, 2, 50, 9, 36, 3, 54, 0, 35, 51, 39, 22, 36, 4,
32, "type", 45, 32, "Caught in root: ", 36, 4, 2, "concat", 2, 2, "print", 1, 35, 39, 2, 35, 49, 35, 35, 32, "The end",
2, "print", 1, 35, 35, 57, 57, 57]
10 changes: 10 additions & 0 deletions hogvm/__tests__/__snapshots__/functionVars.hoge
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
["_H", 1, 52, "execFunction", 0, 0, 8, 32, "execFunction", 2, "print", 1, 35, 31, 38, 53, 0, 52, "execFunctionNested",
0, 0, 29, 52, "execFunction", 0, 0, 8, 32, "execFunctionNew", 2, "print", 1, 35, 31, 38, 53, 0, 32,
"execFunctionNested", 2, "print", 1, 35, 36, 0, 54, 0, 35, 31, 38, 35, 53, 0, 36, 0, 54, 0, 35, 36, 1, 54, 0, 35, 36, 0,
54, 0, 35, 32, "--------", 2, "print", 1, 35, 52, "secondExecFunction", 0, 0, 8, 32, "secondExecFunction", 2, "print",
1, 35, 31, 38, 53, 0, 52, "secondExecFunctionNested", 0, 1, 13, 32, "secondExecFunctionNested", 2, "print", 1, 35, 55,
0, 54, 0, 35, 31, 38, 53, 1, true, 2, 36, 2, 54, 0, 35, 36, 3, 54, 0, 35, 36, 2, 54, 0, 35, 32, "--------", 2, "print",
1, 35, 52, "lambda", 0, 0, 5, 32, "base64Decode", 1, 1, 38, 53, 0, 32, "base64Encode", 1, 1, 32,
"http://www.google.com", 36, 5, 54, 1, 2, "print", 1, 35, 32, "http://www.google.com", 36, 5, 54, 1, 36, 4, 54, 0, 54,
1, 2, "print", 1, 35, 32, "http://www.google.com", 36, 5, 54, 1, 36, 4, 54, 0, 54, 1, 2, "print", 1, 35, 35, 35, 35, 57,
35, 35]
13 changes: 13 additions & 0 deletions hogvm/__tests__/__snapshots__/functionVars.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
execFunction
execFunctionNested
execFunctionNew
execFunction
--------
secondExecFunction
secondExecFunctionNested
secondExecFunction
secondExecFunction
--------
aHR0cDovL3d3dy5nb29nbGUuY29t
http://www.google.com
http://www.google.com
35 changes: 21 additions & 14 deletions hogvm/__tests__/__snapshots__/functions.hoge
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
["_H", 1, 32, "-- test functions --", 2, "print", 1, 35, 41, "add", 2, 6, 36, 1, 36, 0, 6, 38, 41, "add2", 2, 9, 36, 1,
36, 0, 6, 36, 2, 38, 35, 41, "mult", 2, 6, 36, 1, 36, 0, 8, 38, 41, "noArgs", 0, 12, 32, "basdfasdf", 33, 3, 33, 2, 6,
36, 1, 38, 35, 35, 41, "empty", 0, 2, 31, 38, 41, "empty2", 0, 2, 31, 38, 41, "empty3", 0, 2, 31, 38, 41, "noReturn", 0,
14, 33, 1, 33, 2, 36, 1, 36, 0, 6, 31, 38, 35, 35, 35, 41, "emptyReturn", 0, 2, 31, 38, 41,
"emptyReturnBeforeOtherStuff", 0, 10, 31, 38, 33, 2, 33, 2, 6, 35, 31, 38, 41, "emptyReturnBeforeOtherStuffNoSemicolon",
0, 6, 33, 2, 33, 2, 6, 38, 41, "ifThenReturn", 0, 8, 30, 40, 2, 31, 38, 33, 4, 38, 33, 3, 33, 4, 2, "add", 2, 2,
"print", 1, 35, 33, 1, 33, 1, 2, "add", 2, 33, 100, 33, 3, 33, 4, 2, "add", 2, 6, 6, 2, "print", 1, 35, 2, "noArgs", 0,
47, 3, 35, 33, -1, 2, "print", 1, 35, 2, "empty", 0, 47, 3, 35, 33, -1, 2, "print", 1, 35, 2, "empty2", 0, 47, 3, 35,
33, -1, 2, "print", 1, 35, 2, "empty3", 0, 47, 3, 35, 33, -1, 2, "print", 1, 35, 2, "noReturn", 0, 47, 3, 35, 33, -1, 2,
"print", 1, 35, 2, "emptyReturn", 0, 47, 3, 35, 33, -1, 2, "print", 1, 35, 2, "emptyReturnBeforeOtherStuff", 0, 47, 3,
35, 33, -1, 2, "print", 1, 35, 2, "emptyReturnBeforeOtherStuffNoSemicolon", 0, 47, 3, 35, 33, -1, 2, "print", 1, 35, 2,
"ifThenReturn", 0, 47, 3, 35, 33, -1, 2, "print", 1, 35, 33, 2, 33, 1, 2, "add", 2, 33, 100, 33, 3, 33, 4, 2, "add", 2,
6, 6, 33, 2, 2, "mult", 2, 2, "print", 1, 35, 33, 2, 33, 1, 2, "add2", 2, 33, 100, 33, 3, 33, 4, 2, "add2", 2, 6, 6, 33,
10, 2, "mult", 2, 2, "print", 1, 35]
["_H", 1, 32, "-- test functions --", 2, "print", 1, 35, 52, "add", 2, 0, 6, 36, 1, 36, 0, 6, 38, 53, 0, 36, 0, 2,
"print", 1, 35, 52, "add2", 2, 0, 9, 36, 1, 36, 0, 6, 36, 2, 38, 35, 53, 0, 36, 1, 2, "print", 1, 35, 52, "mult", 2, 0,
6, 36, 1, 36, 0, 8, 38, 53, 0, 36, 2, 2, "print", 1, 35, 52, "noArgs", 0, 0, 12, 32, "basdfasdf", 33, 3, 33, 2, 6, 36,
1, 38, 35, 35, 53, 0, 36, 3, 2, "print", 1, 35, 52, "empty", 0, 0, 2, 31, 38, 53, 0, 52, "empty2", 0, 0, 2, 31, 38, 53,
0, 52, "empty3", 0, 0, 2, 31, 38, 53, 0, 52, "noReturn", 0, 0, 14, 33, 1, 33, 2, 36, 1, 36, 0, 6, 31, 38, 35, 35, 35,
53, 0, 52, "emptyReturn", 0, 0, 2, 31, 38, 53, 0, 52, "emptyReturnBeforeOtherStuff", 0, 0, 10, 31, 38, 33, 2, 33, 2, 6,
35, 31, 38, 53, 0, 52, "emptyReturnBeforeOtherStuffNoSemicolon", 0, 0, 6, 33, 2, 33, 2, 6, 38, 53, 0, 52,
"ifThenReturn", 0, 0, 8, 30, 40, 2, 31, 38, 33, 4, 38, 53, 0, 33, 3, 33, 4, 36, 0, 54, 2, 2, "print", 1, 35, 33, 1, 33,
1, 36, 0, 54, 2, 33, 100, 33, 3, 33, 4, 36, 0, 54, 2, 6, 6, 2, "print", 1, 35, 36, 3, 54, 0, 47, 3, 35, 33, -1, 2,
"print", 1, 35, 36, 4, 54, 0, 47, 3, 35, 33, -1, 2, "print", 1, 35, 36, 5, 54, 0, 47, 3, 35, 33, -1, 2, "print", 1, 35,
36, 6, 54, 0, 47, 3, 35, 33, -1, 2, "print", 1, 35, 36, 7, 54, 0, 47, 3, 35, 33, -1, 2, "print", 1, 35, 36, 8, 54, 0,
47, 3, 35, 33, -1, 2, "print", 1, 35, 36, 9, 54, 0, 47, 3, 35, 33, -1, 2, "print", 1, 35, 36, 10, 54, 0, 47, 3, 35, 33,
-1, 2, "print", 1, 35, 36, 11, 54, 0, 47, 3, 35, 33, -1, 2, "print", 1, 35, 33, 2, 33, 1, 36, 0, 54, 2, 33, 100, 33, 3,
33, 4, 36, 0, 54, 2, 6, 6, 33, 2, 36, 2, 54, 2, 2, "print", 1, 35, 33, 2, 33, 1, 36, 1, 54, 2, 33, 100, 33, 3, 33, 4,
36, 1, 54, 2, 6, 6, 33, 10, 36, 2, 54, 2, 2, "print", 1, 35, 52, "printArgs", 7, 0, 20, 36, 0, 36, 1, 36, 2, 36, 3, 36,
4, 36, 5, 36, 6, 2, "print", 7, 35, 31, 38, 53, 0, 52, "lambda", 7, 0, 20, 36, 0, 36, 1, 36, 2, 36, 3, 36, 4, 36, 5, 36,
6, 2, "print", 7, 35, 31, 38, 53, 0, 33, 1, 33, 2, 33, 3, 33, 4, 33, 5, 33, 6, 33, 7, 36, 12, 54, 7, 35, 33, 1, 33, 2,
33, 3, 33, 4, 33, 5, 33, 6, 33, 7, 36, 13, 54, 7, 35, 33, 1, 33, 2, 33, 3, 33, 4, 33, 5, 33, 6, 36, 12, 54, 6, 35, 33,
1, 33, 2, 33, 3, 33, 4, 33, 5, 33, 6, 36, 13, 54, 6, 35, 33, 1, 33, 2, 33, 3, 33, 4, 33, 5, 36, 12, 54, 5, 35, 33, 1,
33, 2, 33, 3, 33, 4, 33, 5, 36, 13, 54, 5, 35, 36, 12, 54, 0, 35, 36, 13, 54, 0, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35]
12 changes: 12 additions & 0 deletions hogvm/__tests__/__snapshots__/functions.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
-- test functions --
fn<add(2)>
fn<add2(2)>
fn<mult(2)>
fn<noArgs(0)>
7
109
5
Expand All @@ -12,3 +16,11 @@
4
220
1100
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 null
1 2 3 4 5 6 null
1 2 3 4 5 null null
1 2 3 4 5 null null
null null null null null null null
null null null null null null null
7 changes: 7 additions & 0 deletions hogvm/__tests__/__snapshots__/lambdas.hoge
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
["_H", 1, 52, "lambda", 1, 0, 6, 33, 2, 36, 0, 8, 38, 53, 0, 36, 0, 2, "print", 1, 35, 33, 2, 36, 0, 54, 1, 2, "print",
1, 35, 33, 8, 36, 0, 54, 1, 2, "print", 1, 35, 32, "--------", 2, "print", 1, 35, 52, "lambda", 1, 0, 6, 33, 2, 36, 0,
8, 38, 53, 0, 36, 1, 43, 1, 33, 2, 36, 1, 54, 1, 2, "print", 1, 35, 33, 2, 36, 2, 33, 1, 45, 54, 1, 2, "print", 1, 35,
33, 2, 52, "lambda", 1, 0, 6, 33, 2, 36, 0, 8, 38, 53, 0, 54, 1, 2, "print", 1, 35, 32, "--------", 2, "print", 1, 35,
52, "lambda", 1, 0, 20, 36, 0, 2, "print", 1, 35, 32, "moo", 2, "print", 1, 35, 32, "cow", 2, "print", 1, 35, 31, 38,
53, 0, 33, 2, 36, 3, 54, 1, 35, 32, "--------", 2, "print", 1, 35, 52, "lambda", 0, 0, 14, 32, "moo", 2, "print", 1, 35,
32, "cow", 2, "print", 1, 35, 31, 38, 53, 0, 36, 4, 54, 0, 35, 35, 35, 35, 35, 35]
14 changes: 14 additions & 0 deletions hogvm/__tests__/__snapshots__/lambdas.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fn<lambda(1)>
4
16
--------
4
4
4
--------
2
moo
cow
--------
moo
cow
16 changes: 8 additions & 8 deletions hogvm/__tests__/__snapshots__/mandelbrot.hoge
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
["_H", 1, 41, "mandelbrot", 3, 93, 34, 0.0, 34, 0.0, 33, 0, 33, 4, 36, 4, 36, 4, 8, 36, 3, 36, 3, 8, 6, 16, 36, 2, 36,
5, 15, 3, 2, 40, 44, 36, 0, 36, 4, 36, 4, 8, 36, 3, 36, 3, 8, 7, 6, 36, 1, 36, 4, 36, 3, 33, 2, 8, 8, 6, 36, 6, 37, 3,
36, 7, 37, 4, 33, 1, 36, 5, 6, 37, 5, 35, 35, 39, -67, 36, 2, 36, 5, 11, 40, 5, 32, " ", 38, 39, 3, 32, "#", 38, 31, 38,
35, 35, 35, 41, "main", 0, 119, 33, 80, 33, 24, 34, -2.0, 34, 1.0, 34, -1.0, 34, 1.0, 33, 30, 33, 0, 36, 1, 36, 7, 15,
40, 86, 32, "", 33, 0, 36, 0, 36, 9, 15, 40, 58, 36, 2, 36, 2, 36, 3, 7, 36, 0, 36, 9, 9, 8, 6, 36, 4, 36, 4, 36, 5, 7,
36, 1, 36, 7, 9, 8, 6, 36, 10, 36, 11, 36, 6, 2, "mandelbrot", 3, 36, 8, 36, 12, 2, "concat", 2, 37, 8, 33, 1, 36, 9, 6,
37, 9, 35, 35, 35, 39, -65, 36, 8, 2, "print", 1, 35, 33, 1, 36, 7, 6, 37, 7, 35, 35, 39, -93, 31, 38, 35, 35, 35, 35,
35, 35, 35, 35, 2, "main", 0, 35]
["_H", 1, 52, "mandelbrot", 3, 0, 93, 34, 0.0, 34, 0.0, 33, 0, 33, 4, 36, 4, 36, 4, 8, 36, 3, 36, 3, 8, 6, 16, 36, 2,
36, 5, 15, 3, 2, 40, 44, 36, 0, 36, 4, 36, 4, 8, 36, 3, 36, 3, 8, 7, 6, 36, 1, 36, 4, 36, 3, 33, 2, 8, 8, 6, 36, 6, 37,
3, 36, 7, 37, 4, 33, 1, 36, 5, 6, 37, 5, 35, 35, 39, -67, 36, 2, 36, 5, 11, 40, 5, 32, " ", 38, 39, 3, 32, "#", 38, 31,
38, 35, 35, 35, 53, 0, 52, "main", 0, 1, 120, 33, 80, 33, 24, 34, -2.0, 34, 1.0, 34, -1.0, 34, 1.0, 33, 30, 33, 0, 36,
1, 36, 7, 15, 40, 87, 32, "", 33, 0, 36, 0, 36, 9, 15, 40, 59, 36, 2, 36, 2, 36, 3, 7, 36, 0, 36, 9, 9, 8, 6, 36, 4, 36,
4, 36, 5, 7, 36, 1, 36, 7, 9, 8, 6, 36, 10, 36, 11, 36, 6, 55, 0, 54, 3, 36, 8, 36, 12, 2, "concat", 2, 37, 8, 33, 1,
36, 9, 6, 37, 9, 35, 35, 35, 39, -66, 36, 8, 2, "print", 1, 35, 33, 1, 36, 7, 6, 37, 7, 35, 35, 39, -94, 31, 38, 35, 35,
35, 35, 35, 35, 35, 35, 53, 1, true, 0, 36, 1, 54, 0, 35, 35, 57]
Loading

0 comments on commit be9c065

Please sign in to comment.