[fine] Fix block compilation
This commit is contained in:
parent
1eb7da77fc
commit
40d611ae37
3 changed files with 83 additions and 30 deletions
|
|
@ -1,32 +1,43 @@
|
|||
1 * 2 + -3 * 4;
|
||||
fun test() {
|
||||
1 * 2 + -3 * 4
|
||||
}
|
||||
|
||||
// @no-errors
|
||||
// @type: 6 f64
|
||||
// @eval: Float(-10.0)
|
||||
// @type: 23 f64
|
||||
// @concrete:
|
||||
// | File
|
||||
// | ExpressionStatement
|
||||
// | BinaryExpression
|
||||
// | BinaryExpression
|
||||
// | LiteralExpression
|
||||
// | Number:'"1"'
|
||||
// | Star:'"*"'
|
||||
// | LiteralExpression
|
||||
// | Number:'"2"'
|
||||
// | Plus:'"+"'
|
||||
// | BinaryExpression
|
||||
// | UnaryExpression
|
||||
// | Minus:'"-"'
|
||||
// | LiteralExpression
|
||||
// | Number:'"3"'
|
||||
// | Star:'"*"'
|
||||
// | LiteralExpression
|
||||
// | Number:'"4"'
|
||||
// | Semicolon:'";"'
|
||||
// | FunctionDecl
|
||||
// | Fun:'"fun"'
|
||||
// | Identifier:'"test"'
|
||||
// | ParamList
|
||||
// | LeftParen:'"("'
|
||||
// | RightParen:'")"'
|
||||
// | Block
|
||||
// | LeftBrace:'"{"'
|
||||
// | ExpressionStatement
|
||||
// | BinaryExpression
|
||||
// | BinaryExpression
|
||||
// | LiteralExpression
|
||||
// | Number:'"1"'
|
||||
// | Star:'"*"'
|
||||
// | LiteralExpression
|
||||
// | Number:'"2"'
|
||||
// | Plus:'"+"'
|
||||
// | BinaryExpression
|
||||
// | UnaryExpression
|
||||
// | Minus:'"-"'
|
||||
// | LiteralExpression
|
||||
// | Number:'"3"'
|
||||
// | Star:'"*"'
|
||||
// | LiteralExpression
|
||||
// | Number:'"4"'
|
||||
// | RightBrace:'"}"'
|
||||
// |
|
||||
// @compiles-to:
|
||||
// | function << module >> (0 args, 0 locals):
|
||||
// | function test (0 args, 0 locals):
|
||||
// | strings (0):
|
||||
// | code (12):
|
||||
// | code (10):
|
||||
// | 0: PushFloat(1.0)
|
||||
// | 1: PushFloat(2.0)
|
||||
// | 2: FloatMultiply
|
||||
|
|
@ -36,7 +47,10 @@
|
|||
// | 6: PushFloat(4.0)
|
||||
// | 7: FloatMultiply
|
||||
// | 8: FloatAdd
|
||||
// | 9: Discard
|
||||
// | 10: PushNothing
|
||||
// | 11: Return
|
||||
// | 9: Return
|
||||
// | function << module >> (0 args, 0 locals):
|
||||
// | strings (0):
|
||||
// | code (2):
|
||||
// | 0: PushNothing
|
||||
// | 1: Return
|
||||
// |
|
||||
|
|
|
|||
|
|
@ -1,10 +1,34 @@
|
|||
{}
|
||||
fun test() {
|
||||
{}
|
||||
}
|
||||
|
||||
// @no-errors
|
||||
// @type: 0 ()
|
||||
// @compiles-to:
|
||||
// | function test (0 args, 0 locals):
|
||||
// | strings (0):
|
||||
// | code (2):
|
||||
// | 0: PushNothing
|
||||
// | 1: Return
|
||||
// | function << module >> (0 args, 0 locals):
|
||||
// | strings (0):
|
||||
// | code (2):
|
||||
// | 0: PushNothing
|
||||
// | 1: Return
|
||||
// |
|
||||
// @eval: Nothing
|
||||
// @type: 15 ()
|
||||
// @concrete:
|
||||
// | File
|
||||
// | Block
|
||||
// | LeftBrace:'"{"'
|
||||
// | RightBrace:'"}"'
|
||||
// | FunctionDecl
|
||||
// | Fun:'"fun"'
|
||||
// | Identifier:'"test"'
|
||||
// | ParamList
|
||||
// | LeftParen:'"("'
|
||||
// | RightParen:'")"'
|
||||
// | Block
|
||||
// | LeftBrace:'"{"'
|
||||
// | Block
|
||||
// | LeftBrace:'"{"'
|
||||
// | RightBrace:'"}"'
|
||||
// | RightBrace:'"}"'
|
||||
// |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue