Skip to content

Commit

Permalink
Fix some typos and change HashSet to FxHashSet
Browse files Browse the repository at this point in the history
  • Loading branch information
raskad committed Sep 30, 2021
1 parent 8b5fadb commit b459f1e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion boa/src/syntax/parser/expression/primary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ where
}
Ok(Identifier::from("yield").into())
}
TokenKind::Keyword(Keyword::Await) if self.allow_yield.0 => {
TokenKind::Keyword(Keyword::Await) if self.allow_await.0 => {
// Early Error: It is a Syntax Error if this production has an [Await] parameter and StringValue of Identifier is "await".
Err(ParseError::general(
"Unexpected identifier",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ where
return Ok(node::PropertyDefinition::property(property_name, value));
}

let ordinary = cursor.peek(0)?.ok_or(ParseError::AbruptEnd)?.kind()
let ordinary_method = cursor.peek(0)?.ok_or(ParseError::AbruptEnd)?.kind()
== &TokenKind::Punctuator(Punctuator::OpenParen);

match property_name {
// MethodDefinition[?Yield, ?Await] -> get ClassElementName[?Yield, ?Await] ( ) { FunctionBody[~Yield, ~Await] }
node::PropertyName::Literal(str) if str.as_ref() == "get" && !ordinary => {
node::PropertyName::Literal(str) if str.as_ref() == "get" && !ordinary_method => {
property_name =
PropertyName::new(self.allow_yield, self.allow_await).parse(cursor)?;

Expand Down Expand Up @@ -302,7 +302,7 @@ where
))
}
// MethodDefinition[?Yield, ?Await] -> set ClassElementName[?Yield, ?Await] ( PropertySetParameterList ) { FunctionBody[~Yield, ~Await] }
node::PropertyName::Literal(str) if str.as_ref() == "set" && !ordinary => {
node::PropertyName::Literal(str) if str.as_ref() == "set" && !ordinary_method => {
property_name =
PropertyName::new(self.allow_yield, self.allow_await).parse(cursor)?;

Expand Down
5 changes: 3 additions & 2 deletions boa/src/syntax/parser/function/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ use crate::{
},
BoaProfiler,
};
use std::{collections::HashSet, io::Read};
use rustc_hash::FxHashSet;
use std::io::Read;

/// Intermediate type for a list of FormalParameters with some meta information.
pub(in crate::syntax::parser) struct FormalParameterList {
Expand Down Expand Up @@ -83,7 +84,7 @@ where
}
let start_position = next_token.span().start();

let mut parameter_names = HashSet::new();
let mut parameter_names = FxHashSet::default();

loop {
let mut rest_param = false;
Expand Down
2 changes: 1 addition & 1 deletion boa/src/syntax/parser/statement/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ where
Ok("yield".into())
}
}
TokenKind::Keyword(Keyword::Await) if self.allow_yield.0 => {
TokenKind::Keyword(Keyword::Await) if self.allow_await.0 => {
// Early Error: It is a Syntax Error if this production has an [Await] parameter and StringValue of Identifier is "await".
Err(ParseError::general(
"Unexpected identifier",
Expand Down

0 comments on commit b459f1e

Please sign in to comment.