59 lines
1.3 KiB
Text
59 lines
1.3 KiB
Text
if true { "discarded"; 23 } else { 45 }
|
|
|
|
// @no-errors
|
|
// Here come some type probes!
|
|
// (type of the condition)
|
|
// @type: 3 bool
|
|
//
|
|
// (the discarded expression)
|
|
// @type: 10 string
|
|
//
|
|
// (the "then" clause)
|
|
// @type: 23 f64
|
|
// @type: 26 f64
|
|
//
|
|
// (the "else" clause)
|
|
// @type: 35 f64
|
|
// @type: 38 f64
|
|
//
|
|
// (the overall expression)
|
|
// @type: 0 f64
|
|
//
|
|
// @concrete:
|
|
// | File
|
|
// | IfStatement
|
|
// | ConditionalExpression
|
|
// | If:'"if"'
|
|
// | LiteralExpression
|
|
// | True:'"true"'
|
|
// | Block
|
|
// | LeftBrace:'"{"'
|
|
// | ExpressionStatement
|
|
// | LiteralExpression
|
|
// | String:'"\"discarded\""'
|
|
// | Semicolon:'";"'
|
|
// | ExpressionStatement
|
|
// | LiteralExpression
|
|
// | Number:'"23"'
|
|
// | RightBrace:'"}"'
|
|
// | Else:'"else"'
|
|
// | Block
|
|
// | LeftBrace:'"{"'
|
|
// | ExpressionStatement
|
|
// | LiteralExpression
|
|
// | Number:'"45"'
|
|
// | RightBrace:'"}"'
|
|
//
|
|
// @compiles-to:
|
|
// | function << module >> (0 args, 0 locals):
|
|
// | strings (1):
|
|
// | 0: "discarded"
|
|
// | code (7):
|
|
// | 0: PushTrue
|
|
// | 1: JumpFalse(6)
|
|
// | 2: PushString(0)
|
|
// | 3: Discard
|
|
// | 4: PushFloat(23.0)
|
|
// | 5: Jump(7)
|
|
// | 6: PushFloat(45.0)
|
|
// |
|