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

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

Issue 23190003: ClassMirror.mixin (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase 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') | sdk/lib/mirrors/mirrors.dart » ('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 3865 matching lines...) Expand 10 before | Expand all | Expand 10 after
3876 if (FLAG_trace_parser) { 3876 if (FLAG_trace_parser) {
3877 OS::Print("toplevel parsing typedef class '%s'\n", class_name.ToCString()); 3877 OS::Print("toplevel parsing typedef class '%s'\n", class_name.ToCString());
3878 } 3878 }
3879 const Object& obj = Object::Handle(library_.LookupLocalObject(class_name)); 3879 const Object& obj = Object::Handle(library_.LookupLocalObject(class_name));
3880 if (!obj.IsNull()) { 3880 if (!obj.IsNull()) {
3881 ErrorMsg(classname_pos, "'%s' is already defined", 3881 ErrorMsg(classname_pos, "'%s' is already defined",
3882 class_name.ToCString()); 3882 class_name.ToCString());
3883 } 3883 }
3884 const Class& mixin_application = 3884 const Class& mixin_application =
3885 Class::Handle(Class::New(class_name, script_, classname_pos)); 3885 Class::Handle(Class::New(class_name, script_, classname_pos));
3886 mixin_application.set_is_mixin_typedef();
3886 library_.AddClass(mixin_application); 3887 library_.AddClass(mixin_application);
3887 set_current_class(mixin_application); 3888 set_current_class(mixin_application);
3888 ParseTypeParameters(mixin_application); 3889 ParseTypeParameters(mixin_application);
3889 3890
3890 ExpectToken(Token::kASSIGN); 3891 ExpectToken(Token::kASSIGN);
3891 3892
3892 if (CurrentToken() == Token::kABSTRACT) { 3893 if (CurrentToken() == Token::kABSTRACT) {
3893 mixin_application.set_is_abstract(); 3894 mixin_application.set_is_abstract();
3894 ConsumeToken(); 3895 ConsumeToken();
3895 } 3896 }
3896 3897
3897 const intptr_t type_pos = TokenPos(); 3898 const intptr_t type_pos = TokenPos();
3898 AbstractType& type = 3899 AbstractType& type =
3899 AbstractType::Handle(ParseType(ClassFinalizer::kResolveTypeParameters)); 3900 AbstractType::Handle(ParseType(ClassFinalizer::kResolveTypeParameters));
3900 if (type.IsTypeParameter()) { 3901 if (type.IsTypeParameter()) {
3901 ErrorMsg(type_pos, 3902 ErrorMsg(type_pos,
3902 "class '%s' may not extend type parameter '%s'", 3903 "class '%s' may not extend type parameter '%s'",
3903 class_name.ToCString(), 3904 class_name.ToCString(),
3904 String::Handle(type.UserVisibleName()).ToCString()); 3905 String::Handle(type.UserVisibleName()).ToCString());
3905 } 3906 }
3906 3907
3907 if (CurrentToken() != Token::kWITH) { 3908 if (CurrentToken() != Token::kWITH) {
3908 ErrorMsg("mixin application 'with Type' expected"); 3909 ErrorMsg("mixin application 'with Type' expected");
3909 } 3910 }
3910 type = ParseMixins(type); 3911 type = ParseMixins(type);
3911 3912
3912 // TODO(hausner): treat the mixin application as an alias, not as a base 3913 // TODO(12773): Treat the mixin application as an alias, not as a base
3913 // class whose super class is the mixin application! 3914 // class whose super class is the mixin application! This is difficult because
3915 // of issues involving subsitution of type parameters
3914 mixin_application.set_super_type(type); 3916 mixin_application.set_super_type(type);
3915 mixin_application.set_is_synthesized_class(); 3917 mixin_application.set_is_synthesized_class();
3916 3918
3917 // This mixin application typedef needs an implicit constructor, but it is 3919 // This mixin application typedef needs an implicit constructor, but it is
3918 // too early to call 'AddImplicitConstructor(mixin_application)' here, 3920 // too early to call 'AddImplicitConstructor(mixin_application)' here,
3919 // because this class should be lazily compiled. 3921 // because this class should be lazily compiled.
3920 if (CurrentToken() == Token::kIMPLEMENTS) { 3922 if (CurrentToken() == Token::kIMPLEMENTS) {
3923 // At this point, the mixin_application alias already has an interface, but
3924 // ParseInterfaceList will add to the list and not lose the one already
3925 // there.
3921 ParseInterfaceList(mixin_application); 3926 ParseInterfaceList(mixin_application);
3922 } 3927 }
3923 ExpectSemicolon(); 3928 ExpectSemicolon();
3924 pending_classes.Add(mixin_application, Heap::kOld); 3929 pending_classes.Add(mixin_application, Heap::kOld);
3925 if (metadata_pos >= 0) { 3930 if (metadata_pos >= 0) {
3926 library_.AddClassMetadata(mixin_application, metadata_pos); 3931 library_.AddClassMetadata(mixin_application, metadata_pos);
3927 } 3932 }
3928 } 3933 }
3929 3934
3930 3935
(...skipping 6538 matching lines...) Expand 10 before | Expand all | Expand 10 after
10469 void Parser::SkipQualIdent() { 10474 void Parser::SkipQualIdent() {
10470 ASSERT(IsIdentifier()); 10475 ASSERT(IsIdentifier());
10471 ConsumeToken(); 10476 ConsumeToken();
10472 if (CurrentToken() == Token::kPERIOD) { 10477 if (CurrentToken() == Token::kPERIOD) {
10473 ConsumeToken(); // Consume the kPERIOD token. 10478 ConsumeToken(); // Consume the kPERIOD token.
10474 ExpectIdentifier("identifier expected after '.'"); 10479 ExpectIdentifier("identifier expected after '.'");
10475 } 10480 }
10476 } 10481 }
10477 10482
10478 } // namespace dart 10483 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | sdk/lib/mirrors/mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698