[cleanup] Remove dead code from Variable and simplify PatternRewriter slightly

Both bits of code were pointed out by our test coverage tools.

R=gsathya@chromium.org

Review-Url: https://codereview.chromium.org/2394403002
Cr-Commit-Position: refs/heads/master@{#40095}
This commit is contained in:
adamk 2016-10-07 11:52:56 -07:00 committed by Commit bot
parent 0004733c08
commit 707934cf9e
4 changed files with 6 additions and 24 deletions

View File

@ -40,14 +40,5 @@ bool Variable::IsGlobalObjectProperty() const {
scope_ != NULL && scope_->is_script_scope();
}
bool Variable::IsStaticGlobalObjectProperty() const {
// Temporaries are never global, they must always be allocated in the
// activation frame.
return (IsDeclaredVariableMode(mode()) && !IsLexicalVariableMode(mode())) &&
scope_ != NULL && scope_->is_script_scope();
}
} // namespace internal
} // namespace v8

View File

@ -64,7 +64,6 @@ class Variable final : public ZoneObject {
bool IsContextSlot() const { return location() == VariableLocation::CONTEXT; }
bool IsLookupSlot() const { return location() == VariableLocation::LOOKUP; }
bool IsGlobalObjectProperty() const;
bool IsStaticGlobalObjectProperty() const;
bool is_dynamic() const { return IsDynamicVariableMode(mode()); }
bool binding_needs_init() const {

View File

@ -358,11 +358,13 @@ class Parser : public ParserBase<Parser> {
void VisitObjectLiteral(ObjectLiteral* node, Variable** temp_var);
void VisitArrayLiteral(ArrayLiteral* node, Variable** temp_var);
bool IsBindingContext() const { return IsBindingContext(context_); }
bool IsBindingContext() const {
return context_ == BINDING || context_ == INITIALIZER;
}
bool IsInitializerContext() const { return context_ != ASSIGNMENT; }
bool IsAssignmentContext() const { return IsAssignmentContext(context_); }
bool IsAssignmentContext(PatternContext c) const;
bool IsBindingContext(PatternContext c) const;
bool IsAssignmentContext() const {
return context_ == ASSIGNMENT || context_ == ASSIGNMENT_INITIALIZER;
}
bool IsSubPattern() const { return recursion_level_ > 1; }
PatternContext SetAssignmentContextIfNeeded(Expression* node);
PatternContext SetInitializerContextIfNeeded(Expression* node);

View File

@ -67,16 +67,6 @@ Expression* Parser::PatternRewriter::RewriteDestructuringAssignment(
}
bool Parser::PatternRewriter::IsAssignmentContext(PatternContext c) const {
return c == ASSIGNMENT || c == ASSIGNMENT_INITIALIZER;
}
bool Parser::PatternRewriter::IsBindingContext(PatternContext c) const {
return c == BINDING || c == INITIALIZER;
}
Parser::PatternRewriter::PatternContext
Parser::PatternRewriter::SetAssignmentContextIfNeeded(Expression* node) {
PatternContext old_context = context();