| 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/ast/variables.h" | 5 #include "src/ast/variables.h" |
| 6 | 6 |
| 7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/globals.h" | 9 #include "src/globals.h" |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 UNREACHABLE(); | 28 UNREACHABLE(); |
| 29 return NULL; | 29 return NULL; |
| 30 } | 30 } |
| 31 | 31 |
| 32 Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode, | 32 Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode, |
| 33 Kind kind, InitializationFlag initialization_flag, | 33 Kind kind, InitializationFlag initialization_flag, |
| 34 MaybeAssignedFlag maybe_assigned_flag) | 34 MaybeAssignedFlag maybe_assigned_flag) |
| 35 : scope_(scope), | 35 : scope_(scope), |
| 36 name_(name), | 36 name_(name), |
| 37 local_if_not_shadowed_(nullptr), |
| 38 index_(-1), |
| 39 initializer_position_(kNoSourcePosition), |
| 37 mode_(mode), | 40 mode_(mode), |
| 38 kind_(kind), | 41 kind_(kind), |
| 39 location_(VariableLocation::UNALLOCATED), | 42 location_(VariableLocation::UNALLOCATED), |
| 40 index_(-1), | |
| 41 initializer_position_(kNoSourcePosition), | |
| 42 local_if_not_shadowed_(NULL), | |
| 43 force_context_allocation_(false), | 43 force_context_allocation_(false), |
| 44 is_used_(false), | 44 is_used_(false), |
| 45 initialization_flag_(initialization_flag), | 45 initialization_flag_(initialization_flag), |
| 46 maybe_assigned_(maybe_assigned_flag) { | 46 maybe_assigned_(maybe_assigned_flag) { |
| 47 // Var declared variables never need initialization. | 47 // Var declared variables never need initialization. |
| 48 DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization)); | 48 DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 bool Variable::IsGlobalObjectProperty() const { | 52 bool Variable::IsGlobalObjectProperty() const { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 68 | 68 |
| 69 int Variable::CompareIndex(Variable* const* v, Variable* const* w) { | 69 int Variable::CompareIndex(Variable* const* v, Variable* const* w) { |
| 70 int x = (*v)->index(); | 70 int x = (*v)->index(); |
| 71 int y = (*w)->index(); | 71 int y = (*w)->index(); |
| 72 // Consider sorting them according to type as well? | 72 // Consider sorting them according to type as well? |
| 73 return x - y; | 73 return x - y; |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace internal | 76 } // namespace internal |
| 77 } // namespace v8 | 77 } // namespace v8 |
| OLD | NEW |