| 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 "vm/bigint_operations.h" |      8 #include "vm/bigint_operations.h" | 
|      9 #include "vm/bootstrap.h" |      9 #include "vm/bootstrap.h" | 
|     10 #include "vm/class_finalizer.h" |     10 #include "vm/class_finalizer.h" | 
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    740     Isolate* isolate = Isolate::Current(); |    740     Isolate* isolate = Isolate::Current(); | 
|    741     ASSERT(isolate->long_jump_base()->IsSafeToJump()); |    741     ASSERT(isolate->long_jump_base()->IsSafeToJump()); | 
|    742     const Script& script = Script::Handle(isolate, cls.script()); |    742     const Script& script = Script::Handle(isolate, cls.script()); | 
|    743     const Library& lib = Library::Handle(isolate, cls.library()); |    743     const Library& lib = Library::Handle(isolate, cls.library()); | 
|    744     Parser parser(script, lib, cls.token_pos()); |    744     Parser parser(script, lib, cls.token_pos()); | 
|    745     parser.ParseClassDefinition(cls); |    745     parser.ParseClassDefinition(cls); | 
|    746   } |    746   } | 
|    747 } |    747 } | 
|    748  |    748  | 
|    749  |    749  | 
 |    750 RawObject* Parser::ParseFunctionParameters(const Function& func) { | 
 |    751   ASSERT(!func.IsNull()); | 
 |    752   Isolate* isolate = Isolate::Current(); | 
 |    753   StackZone zone(isolate); | 
 |    754   LongJump* base = isolate->long_jump_base(); | 
 |    755   LongJump jump; | 
 |    756   isolate->set_long_jump_base(&jump); | 
 |    757   if (setjmp(*jump.Set()) == 0) { | 
 |    758     const Script& script = Script::Handle(isolate, func.script()); | 
 |    759     const Class& owner = Class::Handle(isolate, func.Owner()); | 
 |    760     ASSERT(!owner.IsNull()); | 
 |    761     const Library& lib = Library::Handle(isolate, owner.library()); | 
 |    762     Parser parser(script, lib, func.token_pos()); | 
 |    763     parser.set_current_class(owner); | 
 |    764     parser.SkipFunctionPreamble(); | 
 |    765     ParamList params; | 
 |    766     parser.ParseFormalParameterList(true, ¶ms); | 
 |    767     ParamDesc* param = params.parameters->data(); | 
 |    768     const int param_cnt = params.num_fixed_parameters + | 
 |    769                           params.num_optional_parameters; | 
 |    770     Array& param_descriptor = Array::Handle(Array::New(param_cnt * 2)); | 
 |    771     for (int i = 0, j = 0; i < param_cnt; i++, j += 2) { | 
 |    772       param_descriptor.SetAt(j, param[i].is_final ? Bool::True() : | 
 |    773                                                     Bool::False()); | 
 |    774       param_descriptor.SetAt(j + 1, | 
 |    775           (param[i].default_value == NULL) ? Object::null_instance() : | 
 |    776                                              *(param[i].default_value)); | 
 |    777     } | 
 |    778     return param_descriptor.raw(); | 
 |    779   } else { | 
 |    780     Error& error = Error::Handle(); | 
 |    781     error = isolate->object_store()->sticky_error(); | 
 |    782     isolate->object_store()->clear_sticky_error(); | 
 |    783     isolate->set_long_jump_base(base); | 
 |    784     return error.raw(); | 
 |    785   } | 
 |    786   UNREACHABLE(); | 
 |    787   return Object::null(); | 
 |    788 } | 
 |    789  | 
 |    790  | 
|    750 void Parser::ParseFunction(ParsedFunction* parsed_function) { |    791 void Parser::ParseFunction(ParsedFunction* parsed_function) { | 
|    751   TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer); |    792   TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer); | 
|    752   Isolate* isolate = Isolate::Current(); |    793   Isolate* isolate = Isolate::Current(); | 
|    753   ASSERT(isolate->long_jump_base()->IsSafeToJump()); |    794   ASSERT(isolate->long_jump_base()->IsSafeToJump()); | 
|    754   ASSERT(parsed_function != NULL); |    795   ASSERT(parsed_function != NULL); | 
|    755   const Function& func = parsed_function->function(); |    796   const Function& func = parsed_function->function(); | 
|    756   const Script& script = Script::Handle(isolate, func.script()); |    797   const Script& script = Script::Handle(isolate, func.script()); | 
|    757   Parser parser(script, parsed_function, func.token_pos()); |    798   Parser parser(script, parsed_function, func.token_pos()); | 
|    758   SequenceNode* node_sequence = NULL; |    799   SequenceNode* node_sequence = NULL; | 
|    759   Array& default_parameter_values = Array::ZoneHandle(isolate, Array::null()); |    800   Array& default_parameter_values = Array::ZoneHandle(isolate, Array::null()); | 
| (...skipping 9567 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  10327 void Parser::SkipQualIdent() { |  10368 void Parser::SkipQualIdent() { | 
|  10328   ASSERT(IsIdentifier()); |  10369   ASSERT(IsIdentifier()); | 
|  10329   ConsumeToken(); |  10370   ConsumeToken(); | 
|  10330   if (CurrentToken() == Token::kPERIOD) { |  10371   if (CurrentToken() == Token::kPERIOD) { | 
|  10331     ConsumeToken();  // Consume the kPERIOD token. |  10372     ConsumeToken();  // Consume the kPERIOD token. | 
|  10332     ExpectIdentifier("identifier expected after '.'"); |  10373     ExpectIdentifier("identifier expected after '.'"); | 
|  10333   } |  10374   } | 
|  10334 } |  10375 } | 
|  10335  |  10376  | 
|  10336 }  // namespace dart |  10377 }  // namespace dart | 
| OLD | NEW |