OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 void ParsedFunction::SetNodeSequence(SequenceNode* node_sequence) { | 129 void ParsedFunction::SetNodeSequence(SequenceNode* node_sequence) { |
130 ASSERT(node_sequence_ == NULL); | 130 ASSERT(node_sequence_ == NULL); |
131 ASSERT(node_sequence != NULL); | 131 ASSERT(node_sequence != NULL); |
132 node_sequence_ = node_sequence; | 132 node_sequence_ = node_sequence; |
133 } | 133 } |
134 | 134 |
135 | 135 |
136 void ParsedFunction::AddDeferredPrefix(const LibraryPrefix& prefix) { | 136 void ParsedFunction::AddDeferredPrefix(const LibraryPrefix& prefix) { |
137 ASSERT(prefix.is_deferred_load()); | 137 ASSERT(prefix.is_deferred_load()); |
138 ASSERT(!prefix.is_loaded()); | 138 ASSERT(!prefix.is_loaded()); |
139 if (deferred_prefixes_ == NULL) { | 139 for (intptr_t i = 0; i < deferred_prefixes_->length(); i++) { |
140 deferred_prefixes_ = | 140 if ((*deferred_prefixes_)[i]->raw() == prefix.raw()) { |
141 &GrowableObjectArray::ZoneHandle(GrowableObjectArray::New()); | |
142 } | |
143 for (intptr_t i = 0; i < deferred_prefixes_->Length(); i++) { | |
144 if (deferred_prefixes_->At(i) == prefix.raw()) { | |
145 return; | 141 return; |
146 } | 142 } |
147 } | 143 } |
148 deferred_prefixes_->Add(prefix); | 144 deferred_prefixes_->Add(&LibraryPrefix::ZoneHandle(I, prefix.raw())); |
Ivan Posva
2014/06/07 00:31:14
Why do you have to get a new ZoneHandle here? I do
srdjan
2014/06/12 20:25:46
Generally: if a handle's lifetime escapes the scop
| |
149 } | 145 } |
150 | 146 |
151 | 147 |
152 void ParsedFunction::AllocateVariables() { | 148 void ParsedFunction::AllocateVariables() { |
153 LocalScope* scope = node_sequence()->scope(); | 149 LocalScope* scope = node_sequence()->scope(); |
154 const intptr_t num_fixed_params = function().num_fixed_parameters(); | 150 const intptr_t num_fixed_params = function().num_fixed_parameters(); |
155 const intptr_t num_opt_params = function().NumOptionalParameters(); | 151 const intptr_t num_opt_params = function().NumOptionalParameters(); |
156 const intptr_t num_params = num_fixed_params + num_opt_params; | 152 const intptr_t num_params = num_fixed_params + num_opt_params; |
157 // Compute start indices to parameters and locals, and the number of | 153 // Compute start indices to parameters and locals, and the number of |
158 // parameters to copy. | 154 // parameters to copy. |
(...skipping 10880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11039 void Parser::SkipQualIdent() { | 11035 void Parser::SkipQualIdent() { |
11040 ASSERT(IsIdentifier()); | 11036 ASSERT(IsIdentifier()); |
11041 ConsumeToken(); | 11037 ConsumeToken(); |
11042 if (CurrentToken() == Token::kPERIOD) { | 11038 if (CurrentToken() == Token::kPERIOD) { |
11043 ConsumeToken(); // Consume the kPERIOD token. | 11039 ConsumeToken(); // Consume the kPERIOD token. |
11044 ExpectIdentifier("identifier expected after '.'"); | 11040 ExpectIdentifier("identifier expected after '.'"); |
11045 } | 11041 } |
11046 } | 11042 } |
11047 | 11043 |
11048 } // namespace dart | 11044 } // namespace dart |
OLD | NEW |