Closed Bug 1621723 Opened 6 years ago Closed 6 years ago

Remove unnecessary Parser functions

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox76 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(6 files)

  • Parser::checkLexicalDeclarationDirectlyWithinBlock() isn't needed anymore, because we no longer parse lexical declarations in Parser::statement(), but instead only in Parser::statementListItem().
  • Parser::isValidSimpleAssignmentTarget() is only called within a single assertion, but the nodes checked within isValidSimpleAssignmentTarget() are also already processed within the function which contains that assertion.
  • Plus some additional small changes.

Lexical declarations are nowadays only parsed within statementListItem() and
statementListItem() implies we're within a braced block. That means the error
condition which is checked in checkLexicalDeclarationDirectlyWithinBlock() can
never occur when parsing.

Depends on D66467

DeclarationKind::{Import,SimpleCatchParameter,CatchParameter} implies we can't
be directly within the function body scope, so the parameter redeclaration check
can't occur for these declaration kinds.

Depends on D66468

StatementKind::Class is more or less just a parsing artifact for
ClassStatement, so it seems confusing to test for this statement kind when
checking for braced blocks for function declarations.

Depends on D66469

Priority: -- → P1

The enclosing if-condition means p always coerces to true.

Depends on D66470

This function is only called within a single assertion and the function
containing that assertion already covers exactly the same conditions which
are tested within isValidSimpleAssignmentTarget(), so it doesn't seem
useful anymore to keep isValidSimpleAssignmentTarget().

Depends on D66471

Pushed by aiakab@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e846e4bbae2a Part 1: Remove unused JSMSG_FIELDS_NOT_SUPPORTED message. r=arai https://hg.mozilla.org/integration/autoland/rev/f8cb3f9627f2 Part 2: Remove unnecessary function checkLexicalDeclarationDirectlyWithinBlock. r=arai https://hg.mozilla.org/integration/autoland/rev/d541fa04ac97 Part 3: Move check for lexically declared names to applicable types. r=arai https://hg.mozilla.org/integration/autoland/rev/fc81719b2244 Part 4: Remove check for artifical class scope statement. r=arai https://hg.mozilla.org/integration/autoland/rev/776dd7f14e1a Part 5: Remove always true check from if-statement. r=arai https://hg.mozilla.org/integration/autoland/rev/672e6b9a0823 Part 6: Remove isValidSimpleAssignmentTarget function. r=arai
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: