- Check for more error conditions - Move to more definitive error assertions - Simpler error messages in some cases - Test more conditions more thoroughly, revisit old tests
88 lines
1.9 KiB
Text
88 lines
1.9 KiB
Text
let x = 23;
|
|
let y = x * 2;
|
|
let z = y;
|
|
z;
|
|
|
|
fun test() -> f64 {
|
|
x + y
|
|
}
|
|
|
|
// @no-errors
|
|
// @type: 38 f64
|
|
// @eval: Float(69.0)
|
|
// @concrete:
|
|
// | File
|
|
// | LetStatement
|
|
// | Let:'"let"'
|
|
// | Identifier:'"x"'
|
|
// | Equal:'"="'
|
|
// | LiteralExpression
|
|
// | Number:'"23"'
|
|
// | Semicolon:'";"'
|
|
// | LetStatement
|
|
// | Let:'"let"'
|
|
// | Identifier:'"y"'
|
|
// | Equal:'"="'
|
|
// | BinaryExpression
|
|
// | Identifier
|
|
// | Identifier:'"x"'
|
|
// | Star:'"*"'
|
|
// | LiteralExpression
|
|
// | Number:'"2"'
|
|
// | Semicolon:'";"'
|
|
// | LetStatement
|
|
// | Let:'"let"'
|
|
// | Identifier:'"z"'
|
|
// | Equal:'"="'
|
|
// | Identifier
|
|
// | Identifier:'"y"'
|
|
// | Semicolon:'";"'
|
|
// | ExpressionStatement
|
|
// | Identifier
|
|
// | Identifier:'"z"'
|
|
// | Semicolon:'";"'
|
|
// | FunctionDecl
|
|
// | Fun:'"fun"'
|
|
// | Identifier:'"test"'
|
|
// | ParamList
|
|
// | LeftParen:'"("'
|
|
// | RightParen:'")"'
|
|
// | ReturnType
|
|
// | Arrow:'"->"'
|
|
// | TypeExpression
|
|
// | Identifier:'"f64"'
|
|
// | Block
|
|
// | LeftBrace:'"{"'
|
|
// | ExpressionStatement
|
|
// | BinaryExpression
|
|
// | Identifier
|
|
// | Identifier:'"x"'
|
|
// | Plus:'"+"'
|
|
// | Identifier
|
|
// | Identifier:'"y"'
|
|
// | RightBrace:'"}"'
|
|
// |
|
|
// @compiles-to:
|
|
// | function << module >> (0 args, 0 locals):
|
|
// | strings (0):
|
|
// | code (12):
|
|
// | 0: PushFloat(23.0)
|
|
// | 1: StoreModule(0)
|
|
// | 2: LoadModule(0)
|
|
// | 3: PushFloat(2.0)
|
|
// | 4: FloatMultiply
|
|
// | 5: StoreModule(1)
|
|
// | 6: LoadModule(1)
|
|
// | 7: StoreModule(2)
|
|
// | 8: LoadModule(2)
|
|
// | 9: Discard
|
|
// | 10: PushNothing
|
|
// | 11: Return
|
|
// | function test (0 args, 0 locals):
|
|
// | strings (0):
|
|
// | code (4):
|
|
// | 0: LoadModule(0)
|
|
// | 1: LoadModule(1)
|
|
// | 2: FloatAdd
|
|
// | 3: Return
|
|
// |
|