oden/fine/tests/expression/argument.fine

83 lines
1.9 KiB
Text

fun foo(x: f64) -> f64 {
x + 7
}
fun test() -> f64 {
foo(1)
}
// @no-errors
// @eval: Float(8.0)
// @type: 20 f64
// @concrete:
// | File
// | FunctionDecl
// | Fun:'"fun"'
// | Identifier:'"foo"'
// | ParamList
// | LeftParen:'"("'
// | Parameter
// | Identifier:'"x"'
// | Colon:'":"'
// | TypeExpression
// | Identifier:'"f64"'
// | RightParen:'")"'
// | ReturnType
// | Arrow:'"->"'
// | TypeExpression
// | Identifier:'"f64"'
// | Block
// | LeftBrace:'"{"'
// | ExpressionStatement
// | BinaryExpression
// | Identifier
// | Identifier:'"x"'
// | Plus:'"+"'
// | LiteralExpression
// | Number:'"7"'
// | RightBrace:'"}"'
// | FunctionDecl
// | Fun:'"fun"'
// | Identifier:'"test"'
// | ParamList
// | LeftParen:'"("'
// | RightParen:'")"'
// | ReturnType
// | Arrow:'"->"'
// | TypeExpression
// | Identifier:'"f64"'
// | Block
// | LeftBrace:'"{"'
// | ExpressionStatement
// | CallExpression
// | Identifier
// | Identifier:'"foo"'
// | ArgumentList
// | LeftParen:'"("'
// | Argument
// | LiteralExpression
// | Number:'"1"'
// | RightParen:'")"'
// | RightBrace:'"}"'
// |
// @compiles-to:
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing
// | 1: Return
// | function foo (1 args, 0 locals):
// | strings (0):
// | code (4):
// | 0: LoadArgument(0)
// | 1: PushFloat(7.0)
// | 2: FloatAdd
// | 3: Return
// | function test (0 args, 0 locals):
// | strings (0):
// | code (4):
// | 0: PushFloat(1.0)
// | 1: LoadFunction(1)
// | 2: Call(1)
// | 3: Return
// |