Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: src/ast/variables.h

Issue 2324783002: Include only stuff you need, part 9: variables.h (Closed)
Patch Set: rebased Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/scopes.cc ('k') | src/ast/variables.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/variables.h
diff --git a/src/ast/variables.h b/src/ast/variables.h
index 460bb3801253e59f364102337cf283755fbb2d22..e7f53eba8e78c57b92cdf93f9cd0100faf13d08d 100644
--- a/src/ast/variables.h
+++ b/src/ast/variables.h
@@ -6,6 +6,7 @@
#define V8_AST_VARIABLES_H_
#include "src/ast/ast-value-factory.h"
+#include "src/globals.h"
#include "src/zone.h"
namespace v8 {
@@ -17,22 +18,10 @@ namespace internal {
// after binding and variable allocation.
class Variable final : public ZoneObject {
public:
- enum Kind : uint8_t {
- NORMAL,
- FUNCTION,
- THIS,
- ARGUMENTS,
- SLOPPY_FUNCTION_NAME,
- kLastKind = SLOPPY_FUNCTION_NAME
- };
-
- Variable(Scope* scope, const AstRawString* name, VariableMode mode, Kind kind,
- InitializationFlag initialization_flag,
+ Variable(Scope* scope, const AstRawString* name, VariableMode mode,
+ VariableKind kind, InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned);
- // Printing support
- static const char* Mode2String(VariableMode mode);
-
// The source code for an eval() call may refer to a variable that is
// in an outer scope about which we don't know anything (it may not
// be the script scope). scope() is NULL in that case. Currently the
@@ -84,14 +73,14 @@ class Variable final : public ZoneObject {
return initialization_flag() == kNeedsInitialization;
}
bool throw_on_const_assignment(LanguageMode language_mode) const {
- return kind() != SLOPPY_FUNCTION_NAME || is_strict(language_mode);
+ return kind() != SLOPPY_FUNCTION_NAME_VARIABLE || 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_function() const { return kind() == FUNCTION_VARIABLE; }
+ bool is_this() const { return kind() == THIS_VARIABLE; }
+ bool is_arguments() const { return kind() == ARGUMENTS_VARIABLE; }
bool is_sloppy_function_name() const {
- return kind() == SLOPPY_FUNCTION_NAME;
+ return kind() == SLOPPY_FUNCTION_NAME_VARIABLE;
}
Variable* local_if_not_shadowed() const {
@@ -106,7 +95,7 @@ class Variable final : public ZoneObject {
VariableLocation location() const {
return LocationField::decode(bit_field_);
}
- Kind kind() const { return KindField::decode(bit_field_); }
+ VariableKind kind() const { return VariableKindField::decode(bit_field_); }
InitializationFlag initialization_flag() const {
return InitializationFlagField::decode(bit_field_);
}
@@ -140,9 +129,10 @@ class Variable final : public ZoneObject {
uint16_t bit_field_;
class VariableModeField : public BitField16<VariableMode, 0, 3> {};
- class KindField : public BitField16<Kind, VariableModeField::kNext, 3> {};
+ class VariableKindField
+ : public BitField16<VariableKind, VariableModeField::kNext, 3> {};
class LocationField
- : public BitField16<VariableLocation, KindField::kNext, 3> {};
+ : public BitField16<VariableLocation, VariableKindField::kNext, 3> {};
class ForceContextAllocationField
: public BitField16<bool, LocationField::kNext, 1> {};
class IsUsedField
« no previous file with comments | « src/ast/scopes.cc ('k') | src/ast/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698