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

Side by Side Diff: runtime/vm/parser.cc

Issue 23020025: Implement ParameterMirror.{isFinal,hasDefaultValue,defaultValue}. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
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
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, &params);
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));
siva 2013/08/26 05:05:43 Array::Handle(isolate, ...) since you are using th
Michael Lippautz (Google) 2013/08/26 19:45:57 Done.
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);
siva 2013/08/26 05:05:43 why is isolate->set_long_jump_base(base) not done
Michael Lippautz (Google) 2013/08/26 19:45:57 Done.
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 9569 matching lines...) Expand 10 before | Expand all | Expand 10 after
10329 void Parser::SkipQualIdent() { 10370 void Parser::SkipQualIdent() {
10330 ASSERT(IsIdentifier()); 10371 ASSERT(IsIdentifier());
10331 ConsumeToken(); 10372 ConsumeToken();
10332 if (CurrentToken() == Token::kPERIOD) { 10373 if (CurrentToken() == Token::kPERIOD) {
10333 ConsumeToken(); // Consume the kPERIOD token. 10374 ConsumeToken(); // Consume the kPERIOD token.
10334 ExpectIdentifier("identifier expected after '.'"); 10375 ExpectIdentifier("identifier expected after '.'");
10335 } 10376 }
10336 } 10377 }
10337 10378
10338 } // namespace dart 10379 } // namespace dart
OLDNEW
« runtime/vm/parser.h ('K') | « runtime/vm/parser.h ('k') | sdk/lib/mirrors/mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698