Remove unused parser methods (#10942)
* chore: remove unused isStrictBody * chore: remove unused eatRelational
This commit is contained in:
parent
314513374d
commit
197a8da04d
@ -1892,20 +1892,6 @@ export default class ExpressionParser extends LValParser {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
isStrictBody(node: { body: N.BlockStatement }): boolean {
|
|
||||||
const isBlockStatement = node.body.type === "BlockStatement";
|
|
||||||
|
|
||||||
if (isBlockStatement && node.body.directives.length) {
|
|
||||||
for (const directive of node.body.directives) {
|
|
||||||
if (directive.value.value === "use strict") {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
parseFunctionBodyAndFinish(
|
parseFunctionBodyAndFinish(
|
||||||
node: N.BodilessFunctionOrMethodBase,
|
node: N.BodilessFunctionOrMethodBase,
|
||||||
type: string,
|
type: string,
|
||||||
|
|||||||
@ -58,16 +58,6 @@ export default class UtilParser extends Tokenizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eat() for relational operators.
|
|
||||||
|
|
||||||
eatRelational(op: "<" | ">"): boolean {
|
|
||||||
if (this.isRelational(op)) {
|
|
||||||
this.next();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests whether parsed token is a contextual keyword.
|
// Tests whether parsed token is a contextual keyword.
|
||||||
|
|
||||||
isContextual(name: string): boolean {
|
isContextual(name: string): boolean {
|
||||||
|
|||||||
@ -174,26 +174,6 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isStrictBody(node: { body: N.BlockStatement }): boolean {
|
|
||||||
const isBlockStatement = node.body.type === "BlockStatement";
|
|
||||||
|
|
||||||
if (isBlockStatement && node.body.body.length > 0) {
|
|
||||||
for (const directive of node.body.body) {
|
|
||||||
if (
|
|
||||||
directive.type === "ExpressionStatement" &&
|
|
||||||
directive.expression.type === "Literal"
|
|
||||||
) {
|
|
||||||
if (directive.expression.value === "use strict") return true;
|
|
||||||
} else {
|
|
||||||
// Break for the first non literal expression
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
isValidDirective(stmt: N.Statement): boolean {
|
isValidDirective(stmt: N.Statement): boolean {
|
||||||
return (
|
return (
|
||||||
stmt.type === "ExpressionStatement" &&
|
stmt.type === "ExpressionStatement" &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user