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

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

Issue 23458008: Fix bug with reflection on VM-internal native methods. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/language/language.status » ('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 (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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 Isolate* isolate = Isolate::Current(); 755 Isolate* isolate = Isolate::Current();
756 ASSERT(isolate->long_jump_base()->IsSafeToJump()); 756 ASSERT(isolate->long_jump_base()->IsSafeToJump());
757 const Script& script = Script::Handle(isolate, cls.script()); 757 const Script& script = Script::Handle(isolate, cls.script());
758 const Library& lib = Library::Handle(isolate, cls.library()); 758 const Library& lib = Library::Handle(isolate, cls.library());
759 Parser parser(script, lib, cls.token_pos()); 759 Parser parser(script, lib, cls.token_pos());
760 parser.ParseClassDefinition(cls); 760 parser.ParseClassDefinition(cls);
761 } 761 }
762 } 762 }
763 763
764 764
765 static bool IsInvisible(const Function& func) {
766 if (!Library::IsPrivate(String::Handle(func.name()))) return false;
767 // Check for private function in the core libraries.
768 const Class& cls = Class::Handle(func.Owner());
769 const Library& library = Library::Handle(cls.library());
770 if (library.raw() == Library::CoreLibrary()) return true;
771 if (library.raw() == Library::CollectionLibrary()) return true;
772 if (library.raw() == Library::TypedDataLibrary()) return true;
773 if (library.raw() == Library::MathLibrary()) return true;
774 return false;
775 }
776
777
778 RawObject* Parser::ParseFunctionParameters(const Function& func) { 765 RawObject* Parser::ParseFunctionParameters(const Function& func) {
779 ASSERT(!func.IsNull()); 766 ASSERT(!func.IsNull());
780 Isolate* isolate = Isolate::Current(); 767 Isolate* isolate = Isolate::Current();
781 StackZone zone(isolate); 768 StackZone zone(isolate);
782 LongJump* base = isolate->long_jump_base(); 769 LongJump* base = isolate->long_jump_base();
783 LongJump jump; 770 LongJump jump;
784 isolate->set_long_jump_base(&jump); 771 isolate->set_long_jump_base(&jump);
785 if (setjmp(*jump.Set()) == 0) { 772 if (setjmp(*jump.Set()) == 0) {
786 const Script& script = Script::Handle(isolate, func.script()); 773 const Script& script = Script::Handle(isolate, func.script());
787 const Class& owner = Class::Handle(isolate, func.Owner()); 774 const Class& owner = Class::Handle(isolate, func.Owner());
(...skipping 28 matching lines...) Expand all
816 return Object::null(); 803 return Object::null();
817 } 804 }
818 805
819 806
820 void Parser::ParseFunction(ParsedFunction* parsed_function) { 807 void Parser::ParseFunction(ParsedFunction* parsed_function) {
821 TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer); 808 TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer);
822 Isolate* isolate = Isolate::Current(); 809 Isolate* isolate = Isolate::Current();
823 ASSERT(isolate->long_jump_base()->IsSafeToJump()); 810 ASSERT(isolate->long_jump_base()->IsSafeToJump());
824 ASSERT(parsed_function != NULL); 811 ASSERT(parsed_function != NULL);
825 const Function& func = parsed_function->function(); 812 const Function& func = parsed_function->function();
826 // Mark private core library functions as invisible by default.
827 if (IsInvisible(func)) func.set_is_visible(false);
828 const Script& script = Script::Handle(isolate, func.script()); 813 const Script& script = Script::Handle(isolate, func.script());
829 Parser parser(script, parsed_function, func.token_pos()); 814 Parser parser(script, parsed_function, func.token_pos());
830 SequenceNode* node_sequence = NULL; 815 SequenceNode* node_sequence = NULL;
831 Array& default_parameter_values = Array::ZoneHandle(isolate, Array::null()); 816 Array& default_parameter_values = Array::ZoneHandle(isolate, Array::null());
832 switch (func.kind()) { 817 switch (func.kind()) {
833 case RawFunction::kRegularFunction: 818 case RawFunction::kRegularFunction:
834 case RawFunction::kClosureFunction: 819 case RawFunction::kClosureFunction:
835 case RawFunction::kGetterFunction: 820 case RawFunction::kGetterFunction:
836 case RawFunction::kSetterFunction: 821 case RawFunction::kSetterFunction:
837 case RawFunction::kConstructor: 822 case RawFunction::kConstructor:
(...skipping 9628 matching lines...) Expand 10 before | Expand all | Expand 10 after
10466 void Parser::SkipQualIdent() { 10451 void Parser::SkipQualIdent() {
10467 ASSERT(IsIdentifier()); 10452 ASSERT(IsIdentifier());
10468 ConsumeToken(); 10453 ConsumeToken();
10469 if (CurrentToken() == Token::kPERIOD) { 10454 if (CurrentToken() == Token::kPERIOD) {
10470 ConsumeToken(); // Consume the kPERIOD token. 10455 ConsumeToken(); // Consume the kPERIOD token.
10471 ExpectIdentifier("identifier expected after '.'"); 10456 ExpectIdentifier("identifier expected after '.'");
10472 } 10457 }
10473 } 10458 }
10474 10459
10475 } // namespace dart 10460 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698