|
|
@ -215,9 +215,20 @@ where |
|
|
|
property_name, |
|
|
|
property_name, |
|
|
|
)); |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
let (property_name, method) = |
|
|
|
let (class_element_name, method) = |
|
|
|
AsyncMethod::new(self.allow_yield, self.allow_await).parse(cursor, interner)?; |
|
|
|
AsyncMethod::new(self.allow_yield, self.allow_await).parse(cursor, interner)?; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let property_name = if let object::ClassElementName::PropertyName(property_name) = |
|
|
|
|
|
|
|
class_element_name |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
property_name |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return Err(ParseError::general( |
|
|
|
|
|
|
|
"private identifiers not allowed in object literal", |
|
|
|
|
|
|
|
position, |
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
|
|
|
|
// It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
|
|
|
|
if has_direct_super(method.body(), method.parameters()) { |
|
|
|
if has_direct_super(method.body(), method.parameters()) { |
|
|
|
return Err(ParseError::general("invalid super usage", position)); |
|
|
|
return Err(ParseError::general("invalid super usage", position)); |
|
|
@ -888,7 +899,7 @@ impl<R> TokenParser<R> for AsyncMethod |
|
|
|
where |
|
|
|
where |
|
|
|
R: Read, |
|
|
|
R: Read, |
|
|
|
{ |
|
|
|
{ |
|
|
|
type Output = (object::PropertyName, MethodDefinition); |
|
|
|
type Output = (object::ClassElementName, MethodDefinition); |
|
|
|
|
|
|
|
|
|
|
|
fn parse( |
|
|
|
fn parse( |
|
|
|
self, |
|
|
|
self, |
|
|
@ -897,8 +908,8 @@ where |
|
|
|
) -> Result<Self::Output, ParseError> { |
|
|
|
) -> Result<Self::Output, ParseError> { |
|
|
|
let _timer = Profiler::global().start_event("AsyncMethod", "Parsing"); |
|
|
|
let _timer = Profiler::global().start_event("AsyncMethod", "Parsing"); |
|
|
|
|
|
|
|
|
|
|
|
let property_name = |
|
|
|
let class_element_name = |
|
|
|
PropertyName::new(self.allow_yield, self.allow_await).parse(cursor, interner)?; |
|
|
|
ClassElementName::new(self.allow_yield, self.allow_await).parse(cursor, interner)?; |
|
|
|
|
|
|
|
|
|
|
|
let params = UniqueFormalParameters::new(false, true).parse(cursor, interner)?; |
|
|
|
let params = UniqueFormalParameters::new(false, true).parse(cursor, interner)?; |
|
|
|
|
|
|
|
|
|
|
@ -941,7 +952,7 @@ where |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Ok(( |
|
|
|
Ok(( |
|
|
|
property_name, |
|
|
|
class_element_name, |
|
|
|
MethodDefinition::Async(AsyncFunctionExpr::new(None, params, body)), |
|
|
|
MethodDefinition::Async(AsyncFunctionExpr::new(None, params, body)), |
|
|
|
)) |
|
|
|
)) |
|
|
|
} |
|
|
|
} |
|
|
|