perf: Use strict equals

This commit is contained in:
Daniel Tschinder 2019-01-15 13:13:58 -08:00
parent 8df0500f55
commit 0370af58f1
5 changed files with 8 additions and 8 deletions

View File

@ -525,7 +525,7 @@ export default class ExpressionParser extends LValParser {
} else if (this.match(tt.questionDot)) {
this.expectPlugin("optionalChaining");
state.optionalChainMember = true;
if (noCalls && this.lookahead().type == tt.parenL) {
if (noCalls && this.lookahead().type === tt.parenL) {
state.stop = true;
return base;
}

View File

@ -161,7 +161,7 @@ export default class StatementParser extends ExpressionParser {
this.next();
let result;
if (starttype == tt._import) {
if (starttype === tt._import) {
result = this.parseImport(node);
if (
@ -693,9 +693,9 @@ export default class StatementParser extends ExpressionParser {
node.body = this.parseStatement(declaration);
if (
node.body.type == "ClassDeclaration" ||
(node.body.type == "VariableDeclaration" && node.body.kind !== "var") ||
(node.body.type == "FunctionDeclaration" &&
node.body.type === "ClassDeclaration" ||
(node.body.type === "VariableDeclaration" && node.body.kind !== "var") ||
(node.body.type === "FunctionDeclaration" &&
(this.state.strict || node.body.generator || node.body.async))
) {
this.raise(node.body.start, "Invalid labeled declaration");

View File

@ -25,7 +25,7 @@ export default class UtilParser extends Tokenizer {
isLookaheadRelational(op: "<" | ">"): boolean {
const l = this.lookahead();
return l.type == tt.relational && l.value == op;
return l.type === tt.relational && l.value === op;
}
// TODO

View File

@ -1630,7 +1630,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.match(tt.name) &&
(this.state.value === "type" ||
this.state.value === "interface" ||
this.state.value == "opaque")
this.state.value === "opaque")
) {
return false;
}

View File

@ -126,7 +126,7 @@ function ppJSON(v) {
}
function addPath(str, pt) {
if (str.charAt(str.length - 1) == ")") {
if (str.charAt(str.length - 1) === ")") {
return str.slice(0, str.length - 1) + "/" + pt + ")";
} else {
return str + " (" + pt + ")";