Index: src/ast/variables.h |
diff --git a/src/ast/variables.h b/src/ast/variables.h |
index 1d6b33657069efd1b23960fed615fe533c90b08d..01e4d528ddec472d06621d5a101658ebfa59b571 100644 |
--- a/src/ast/variables.h |
+++ b/src/ast/variables.h |
@@ -22,7 +22,8 @@ class Variable final : public ZoneObject { |
FUNCTION, |
THIS, |
ARGUMENTS, |
- kLastKind = ARGUMENTS |
+ SLOPPY_FUNCTION_NAME, |
+ kLastKind = SLOPPY_FUNCTION_NAME |
}; |
Variable(Scope* scope, const AstRawString* name, VariableMode mode, Kind kind, |
@@ -76,16 +77,21 @@ class Variable final : public ZoneObject { |
bool IsStaticGlobalObjectProperty() const; |
bool is_dynamic() const { return IsDynamicVariableMode(mode()); } |
- bool is_const_mode() const { return IsImmutableVariableMode(mode()); } |
bool binding_needs_init() const { |
DCHECK(initialization_flag() != kNeedsInitialization || |
IsLexicalVariableMode(mode())); |
return initialization_flag() == kNeedsInitialization; |
} |
+ bool throw_on_const_assignment(LanguageMode language_mode) const { |
+ return kind() != SLOPPY_FUNCTION_NAME || is_strict(language_mode); |
+ } |
bool is_function() const { return kind() == FUNCTION; } |
bool is_this() const { return kind() == THIS; } |
bool is_arguments() const { return kind() == ARGUMENTS; } |
+ bool is_sloppy_function_name() const { |
+ return kind() == SLOPPY_FUNCTION_NAME; |
+ } |
Variable* local_if_not_shadowed() const { |
DCHECK(mode() == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); |
@@ -128,7 +134,7 @@ class Variable final : public ZoneObject { |
uint16_t bit_field_; |
class VariableModeField : public BitField16<VariableMode, 0, 3> {}; |
- class KindField : public BitField16<Kind, VariableModeField::kNext, 2> {}; |
+ class KindField : public BitField16<Kind, VariableModeField::kNext, 3> {}; |
class LocationField |
: public BitField16<VariableLocation, KindField::kNext, 3> {}; |
class ForceContextAllocationField |