OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/scopes.h" | 8 #include "src/scopes.h" |
9 #include "src/variables.h" | 9 #include "src/variables.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 // ---------------------------------------------------------------------------- | 14 // ---------------------------------------------------------------------------- |
15 // Implementation Variable. | 15 // Implementation Variable. |
16 | 16 |
17 const char* Variable::Mode2String(VariableMode mode) { | 17 const char* Variable::Mode2String(VariableMode mode) { |
18 switch (mode) { | 18 switch (mode) { |
19 case VAR: return "VAR"; | 19 case VAR: return "VAR"; |
20 case CONST_LEGACY: return "CONST_LEGACY"; | 20 case CONST_LEGACY: return "CONST_LEGACY"; |
21 case LET: return "LET"; | 21 case LET: return "LET"; |
22 case CONST: return "CONST"; | 22 case CONST: return "CONST"; |
23 case IMPORT: return "IMPORT"; | 23 case IMPORT: return "IMPORT"; |
24 case DYNAMIC: return "DYNAMIC"; | 24 case DYNAMIC: return "DYNAMIC"; |
25 case DYNAMIC_GLOBAL: return "DYNAMIC_GLOBAL"; | 25 case DYNAMIC_GLOBAL: return "DYNAMIC_GLOBAL"; |
26 case DYNAMIC_LOCAL: return "DYNAMIC_LOCAL"; | 26 case DYNAMIC_LOCAL: return "DYNAMIC_LOCAL"; |
27 case INTERNAL: return "INTERNAL"; | |
28 case TEMPORARY: return "TEMPORARY"; | 27 case TEMPORARY: return "TEMPORARY"; |
29 } | 28 } |
30 UNREACHABLE(); | 29 UNREACHABLE(); |
31 return NULL; | 30 return NULL; |
32 } | 31 } |
33 | 32 |
34 | 33 |
35 Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode, | 34 Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode, |
36 Kind kind, InitializationFlag initialization_flag, | 35 Kind kind, InitializationFlag initialization_flag, |
37 MaybeAssignedFlag maybe_assigned_flag) | 36 MaybeAssignedFlag maybe_assigned_flag) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 73 |
75 int Variable::CompareIndex(Variable* const* v, Variable* const* w) { | 74 int Variable::CompareIndex(Variable* const* v, Variable* const* w) { |
76 int x = (*v)->index(); | 75 int x = (*v)->index(); |
77 int y = (*w)->index(); | 76 int y = (*w)->index(); |
78 // Consider sorting them according to type as well? | 77 // Consider sorting them according to type as well? |
79 return x - y; | 78 return x - y; |
80 } | 79 } |
81 | 80 |
82 } // namespace internal | 81 } // namespace internal |
83 } // namespace v8 | 82 } // namespace v8 |
OLD | NEW |