Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused parser methods #10942

Merged
merged 2 commits into from Dec 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 0 additions & 14 deletions packages/babel-parser/src/parser/expression.js
Expand Up @@ -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(
node: N.BodilessFunctionOrMethodBase,
type: string,
Expand Down
10 changes: 0 additions & 10 deletions packages/babel-parser/src/parser/util.js
Expand Up @@ -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.

isContextual(name: string): boolean {
Expand Down
20 changes: 0 additions & 20 deletions packages/babel-parser/src/plugins/estree.js
Expand Up @@ -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 {
return (
stmt.type === "ExpressionStatement" &&
Expand Down