mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
parent
034ca98182
commit
6360bdad31
3 changed files with 14 additions and 13 deletions
|
|
@ -13,7 +13,7 @@ use crate::{
|
|||
diagnostics,
|
||||
lexer::{Kind, TokenValue},
|
||||
list::SeparatedList,
|
||||
Parser,
|
||||
Context, Parser,
|
||||
};
|
||||
|
||||
impl<'a> Parser<'a> {
|
||||
|
|
@ -635,7 +635,9 @@ impl<'a> Parser<'a> {
|
|||
|
||||
// parse `new ident` without arguments
|
||||
let arguments = if self.at(Kind::LParen) {
|
||||
CallArguments::parse(self)?.elements
|
||||
// ArgumentList[Yield, Await] :
|
||||
// AssignmentExpression[+In, ?Yield, ?Await]
|
||||
self.with_context(Context::In, CallArguments::parse)?.elements
|
||||
} else {
|
||||
self.ast.new_vec()
|
||||
};
|
||||
|
|
@ -743,10 +745,9 @@ impl<'a> Parser<'a> {
|
|||
optional: bool,
|
||||
type_parameters: Option<Box<'a, TSTypeParameterInstantiation<'a>>>,
|
||||
) -> Result<Expression<'a>> {
|
||||
let has_in = self.ctx.has_in();
|
||||
self.ctx = self.ctx.and_in(true);
|
||||
let call_arguments = CallArguments::parse(self)?;
|
||||
self.ctx = self.ctx.and_in(has_in);
|
||||
// ArgumentList[Yield, Await] :
|
||||
// AssignmentExpression[+In, ?Yield, ?Await]
|
||||
let call_arguments = self.with_context(Context::In, CallArguments::parse)?;
|
||||
Ok(self.ast.call_expression(
|
||||
self.end_span(lhs_span),
|
||||
lhs,
|
||||
|
|
|
|||
|
|
@ -7,12 +7,7 @@ use super::{
|
|||
grammar::CoverGrammar,
|
||||
list::SwitchCases,
|
||||
};
|
||||
use crate::{
|
||||
diagnostics,
|
||||
lexer::Kind,
|
||||
list::NormalList,
|
||||
Parser, {Context, StatementContext},
|
||||
};
|
||||
use crate::{diagnostics, lexer::Kind, list::NormalList, Context, Parser, StatementContext};
|
||||
|
||||
impl<'a> Parser<'a> {
|
||||
/// <https://tc39.es/ecma262/#prod-StatementList>
|
||||
|
|
|
|||
|
|
@ -286,7 +286,12 @@ mod test {
|
|||
assert!(!ret.errors.is_empty());
|
||||
}
|
||||
|
||||
let pass = ["async(...null)", "null?async():null", "switch(null){case async():}"];
|
||||
let pass = [
|
||||
"async(...null)",
|
||||
"null?async():null",
|
||||
"switch(null){case async():}",
|
||||
"for(new null(null in null);;);",
|
||||
];
|
||||
|
||||
for source in pass {
|
||||
let ret = Parser::new(&allocator, source, source_type).parse();
|
||||
|
|
|
|||
Loading…
Reference in a new issue