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

Side by Side Diff: test/cctest/scope-test-helper.h

Issue 2679263002: Revert of [parsing] Fix maybe-assigned for loop variables. (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « test/cctest/parsing/test-preparser.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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 #ifndef V8_CCTEST_SCOPE_TEST_HELPER_H_ 5 #ifndef V8_CCTEST_SCOPE_TEST_HELPER_H_
6 #define V8_CCTEST_SCOPE_TEST_HELPER_H_ 6 #define V8_CCTEST_SCOPE_TEST_HELPER_H_
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/ast/variables.h" 9 #include "src/ast/variables.h"
10 10
(...skipping 14 matching lines...) Expand all
25 for (Scope* inner = scope->inner_scope(); inner != nullptr; 25 for (Scope* inner = scope->inner_scope(); inner != nullptr;
26 inner = inner->sibling()) { 26 inner = inner->sibling()) {
27 if (!ScopeTreeIsHidden(inner)) { 27 if (!ScopeTreeIsHidden(inner)) {
28 return false; 28 return false;
29 } 29 }
30 } 30 }
31 return true; 31 return true;
32 } 32 }
33 33
34 static void CompareScopeToData(Scope* scope, const PreParsedScopeData* data, 34 static void CompareScopeToData(Scope* scope, const PreParsedScopeData* data,
35 size_t& index, bool precise_maybe_assigned) { 35 size_t& index) {
36 CHECK_EQ(data->backing_store_[index++], scope->scope_type()); 36 CHECK_EQ(data->backing_store_[index++], scope->scope_type());
37 CHECK_EQ(data->backing_store_[index++], scope->start_position()); 37 CHECK_EQ(data->backing_store_[index++], scope->start_position());
38 CHECK_EQ(data->backing_store_[index++], scope->end_position()); 38 CHECK_EQ(data->backing_store_[index++], scope->end_position());
39 39
40 int inner_scope_count = 0; 40 int inner_scope_count = 0;
41 for (Scope* inner = scope->inner_scope(); inner != nullptr; 41 for (Scope* inner = scope->inner_scope(); inner != nullptr;
42 inner = inner->sibling()) { 42 inner = inner->sibling()) {
43 // FIXME(marja): This is probably not the right condition for knowing what 43 // FIXME(marja): This is probably not the right condition for knowing what
44 // scopes are present in the preparse data. 44 // scopes are present in the preparse data.
45 if (!ScopeTreeIsHidden(inner)) { 45 if (!ScopeTreeIsHidden(inner)) {
(...skipping 17 matching lines...) Expand all
63 local->mode() == CONST) { 63 local->mode() == CONST) {
64 #ifdef DEBUG 64 #ifdef DEBUG
65 const AstRawString* local_name = local->raw_name(); 65 const AstRawString* local_name = local->raw_name();
66 int name_length = data->backing_store_[index++]; 66 int name_length = data->backing_store_[index++];
67 CHECK_EQ(name_length, local_name->length()); 67 CHECK_EQ(name_length, local_name->length());
68 for (int i = 0; i < name_length; ++i) { 68 for (int i = 0; i < name_length; ++i) {
69 CHECK_EQ(data->backing_store_[index++], local_name->raw_data()[i]); 69 CHECK_EQ(data->backing_store_[index++], local_name->raw_data()[i]);
70 } 70 }
71 #endif 71 #endif
72 CHECK_EQ(data->backing_store_[index++], local->location()); 72 CHECK_EQ(data->backing_store_[index++], local->location());
73 if (precise_maybe_assigned) { 73 CHECK_EQ(data->backing_store_[index++], local->maybe_assigned());
74 CHECK_EQ(data->backing_store_[index++], local->maybe_assigned());
75 } else {
76 STATIC_ASSERT(kMaybeAssigned > kNotAssigned);
77 CHECK_GE(data->backing_store_[index++], local->maybe_assigned());
78 }
79 } 74 }
80 } 75 }
81 76
82 for (Scope* inner = scope->inner_scope(); inner != nullptr; 77 for (Scope* inner = scope->inner_scope(); inner != nullptr;
83 inner = inner->sibling()) { 78 inner = inner->sibling()) {
84 if (!ScopeTreeIsHidden(inner)) { 79 if (!ScopeTreeIsHidden(inner)) {
85 CompareScopeToData(inner, data, index, precise_maybe_assigned); 80 CompareScopeToData(inner, data, index);
86 } 81 }
87 } 82 }
88 } 83 }
89 }; 84 };
90 } // namespace internal 85 } // namespace internal
91 } // namespace v8 86 } // namespace v8
92 87
93 #endif // V8_CCTEST_SCOPE_TEST_HELPER_H_ 88 #endif // V8_CCTEST_SCOPE_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « test/cctest/parsing/test-preparser.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698