OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/scopes.h" | 5 #include "src/ast/scopes.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
991 current->set_next_unresolved(next->next_unresolved()); | 991 current->set_next_unresolved(next->next_unresolved()); |
992 var->set_next_unresolved(nullptr); | 992 var->set_next_unresolved(nullptr); |
993 return true; | 993 return true; |
994 } | 994 } |
995 current = next; | 995 current = next; |
996 } | 996 } |
997 return false; | 997 return false; |
998 } | 998 } |
999 | 999 |
1000 bool Scope::RemoveUnresolved(const AstRawString* name) { | 1000 bool Scope::RemoveUnresolved(const AstRawString* name) { |
1001 if (unresolved_->raw_name() == name) { | 1001 if (unresolved_ != nullptr && unresolved_->raw_name() == name) { |
1002 VariableProxy* removed = unresolved_; | 1002 VariableProxy* removed = unresolved_; |
1003 unresolved_ = unresolved_->next_unresolved(); | 1003 unresolved_ = unresolved_->next_unresolved(); |
1004 removed->set_next_unresolved(nullptr); | 1004 removed->set_next_unresolved(nullptr); |
1005 return true; | 1005 return true; |
1006 } | 1006 } |
1007 VariableProxy* current = unresolved_; | 1007 VariableProxy* current = unresolved_; |
1008 while (current != nullptr) { | 1008 while (current != nullptr) { |
1009 VariableProxy* next = current->next_unresolved(); | 1009 VariableProxy* next = current->next_unresolved(); |
1010 if (next->raw_name() == name) { | 1010 if (next != nullptr && next->raw_name() == name) { |
adamk
2016/10/07 18:35:55
Why was this null check (and the one above) not ne
marja
2016/10/07 19:00:27
- This function is only used by the PreParser
- Pr
| |
1011 current->set_next_unresolved(next->next_unresolved()); | 1011 current->set_next_unresolved(next->next_unresolved()); |
1012 next->set_next_unresolved(nullptr); | 1012 next->set_next_unresolved(nullptr); |
1013 return true; | 1013 return true; |
1014 } | 1014 } |
1015 current = next; | 1015 current = next; |
1016 } | 1016 } |
1017 return false; | 1017 return false; |
1018 } | 1018 } |
1019 | 1019 |
1020 Variable* Scope::NewTemporary(const AstRawString* name) { | 1020 Variable* Scope::NewTemporary(const AstRawString* name) { |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1923 Variable* function = | 1923 Variable* function = |
1924 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 1924 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |
1925 bool is_function_var_in_context = | 1925 bool is_function_var_in_context = |
1926 function != nullptr && function->IsContextSlot(); | 1926 function != nullptr && function->IsContextSlot(); |
1927 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1927 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1928 (is_function_var_in_context ? 1 : 0); | 1928 (is_function_var_in_context ? 1 : 0); |
1929 } | 1929 } |
1930 | 1930 |
1931 } // namespace internal | 1931 } // namespace internal |
1932 } // namespace v8 | 1932 } // namespace v8 |
OLD | NEW |