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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 const GrowableObjectArray& pending_functions = | 323 const GrowableObjectArray& pending_functions = |
324 GrowableObjectArray::Handle(I->object_store()->pending_functions()); | 324 GrowableObjectArray::Handle(I->object_store()->pending_functions()); |
325 ASSERT(pending_functions.Length() > 0); | 325 ASSERT(pending_functions.Length() > 0); |
326 ASSERT(pending_functions.At(pending_functions.Length()-1) == | 326 ASSERT(pending_functions.At(pending_functions.Length()-1) == |
327 current_function().raw()); | 327 current_function().raw()); |
328 pending_functions.RemoveLast(); | 328 pending_functions.RemoveLast(); |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 | 332 |
| 333 // Each try in this function gets its own try index. |
| 334 // See definition of RawPcDescriptors::PcDescriptor. |
| 335 int16_t Parser::AllocateTryIndex() { |
| 336 if (!Utils::IsInt(16, last_used_try_index_ - 1)) { |
| 337 ReportError("too many nested try statements"); |
| 338 } |
| 339 return last_used_try_index_++; |
| 340 } |
| 341 |
| 342 |
333 void Parser::SetScript(const Script& script, intptr_t token_pos) { | 343 void Parser::SetScript(const Script& script, intptr_t token_pos) { |
334 script_ = script.raw(); | 344 script_ = script.raw(); |
335 tokens_iterator_.SetStream( | 345 tokens_iterator_.SetStream( |
336 TokenStream::Handle(I, script.tokens()), token_pos); | 346 TokenStream::Handle(I, script.tokens()), token_pos); |
337 token_kind_ = Token::kILLEGAL; | 347 token_kind_ = Token::kILLEGAL; |
338 } | 348 } |
339 | 349 |
340 | 350 |
341 bool Parser::SetAllowFunctionLiterals(bool value) { | 351 bool Parser::SetAllowFunctionLiterals(bool value) { |
342 bool current_value = allow_function_literals_; | 352 bool current_value = allow_function_literals_; |
(...skipping 10727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11070 void Parser::SkipQualIdent() { | 11080 void Parser::SkipQualIdent() { |
11071 ASSERT(IsIdentifier()); | 11081 ASSERT(IsIdentifier()); |
11072 ConsumeToken(); | 11082 ConsumeToken(); |
11073 if (CurrentToken() == Token::kPERIOD) { | 11083 if (CurrentToken() == Token::kPERIOD) { |
11074 ConsumeToken(); // Consume the kPERIOD token. | 11084 ConsumeToken(); // Consume the kPERIOD token. |
11075 ExpectIdentifier("identifier expected after '.'"); | 11085 ExpectIdentifier("identifier expected after '.'"); |
11076 } | 11086 } |
11077 } | 11087 } |
11078 | 11088 |
11079 } // namespace dart | 11089 } // namespace dart |
OLD | NEW |