parser(cursor): Step‑2 cont. – add 'await' unary in TokenCursor path (env‑guarded); no default behavior change

This commit is contained in:
Selfhosting Dev
2025-09-25 06:37:27 +09:00
parent f6fcc64074
commit 4cbf1ca75b

View File

@ -157,6 +157,15 @@ impl ExprParserWithCursor {
span: Span::new(op_line, 0, op_line, 0),
})
}
TokenType::AWAIT => {
let op_line = cursor.current().line;
cursor.advance();
let expression = Self::parse_unary_expr(cursor)?;
Ok(ASTNode::AwaitExpression {
expression: Box::new(expression),
span: Span::new(op_line, 0, op_line, 0),
})
}
_ => Self::parse_postfix_expr(cursor),
}
}