Commit 707934cf authored by adamk's avatar adamk Committed by Commit bot

[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}
parent 0004733c
...@@ -40,14 +40,5 @@ bool Variable::IsGlobalObjectProperty() const { ...@@ -40,14 +40,5 @@ bool Variable::IsGlobalObjectProperty() const {
scope_ != NULL && scope_->is_script_scope(); 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 internal
} // namespace v8 } // namespace v8
...@@ -64,7 +64,6 @@ class Variable final : public ZoneObject { ...@@ -64,7 +64,6 @@ class Variable final : public ZoneObject {
bool IsContextSlot() const { return location() == VariableLocation::CONTEXT; } bool IsContextSlot() const { return location() == VariableLocation::CONTEXT; }
bool IsLookupSlot() const { return location() == VariableLocation::LOOKUP; } bool IsLookupSlot() const { return location() == VariableLocation::LOOKUP; }
bool IsGlobalObjectProperty() const; bool IsGlobalObjectProperty() const;
bool IsStaticGlobalObjectProperty() const;
bool is_dynamic() const { return IsDynamicVariableMode(mode()); } bool is_dynamic() const { return IsDynamicVariableMode(mode()); }
bool binding_needs_init() const { bool binding_needs_init() const {
......
...@@ -358,11 +358,13 @@ class Parser : public ParserBase<Parser> { ...@@ -358,11 +358,13 @@ class Parser : public ParserBase<Parser> {
void VisitObjectLiteral(ObjectLiteral* node, Variable** temp_var); void VisitObjectLiteral(ObjectLiteral* node, Variable** temp_var);
void VisitArrayLiteral(ArrayLiteral* 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 IsInitializerContext() const { return context_ != ASSIGNMENT; }
bool IsAssignmentContext() const { return IsAssignmentContext(context_); } bool IsAssignmentContext() const {
bool IsAssignmentContext(PatternContext c) const; return context_ == ASSIGNMENT || context_ == ASSIGNMENT_INITIALIZER;
bool IsBindingContext(PatternContext c) const; }
bool IsSubPattern() const { return recursion_level_ > 1; } bool IsSubPattern() const { return recursion_level_ > 1; }
PatternContext SetAssignmentContextIfNeeded(Expression* node); PatternContext SetAssignmentContextIfNeeded(Expression* node);
PatternContext SetInitializerContextIfNeeded(Expression* node); PatternContext SetInitializerContextIfNeeded(Expression* node);
......
...@@ -67,16 +67,6 @@ Expression* Parser::PatternRewriter::RewriteDestructuringAssignment( ...@@ -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::PatternContext
Parser::PatternRewriter::SetAssignmentContextIfNeeded(Expression* node) { Parser::PatternRewriter::SetAssignmentContextIfNeeded(Expression* node) {
PatternContext old_context = context(); PatternContext old_context = context();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment