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

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

Issue 12317150: Less confusing names for mixing application classes (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | « no previous file | no next file » | 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/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 3834 matching lines...) Expand 10 before | Expand all | Expand 10 after
3845 } 3845 }
3846 3846
3847 3847
3848 RawType* Parser::ParseMixins(const Type& super_type) { 3848 RawType* Parser::ParseMixins(const Type& super_type) {
3849 TRACE_PARSER("ParseMixins"); 3849 TRACE_PARSER("ParseMixins");
3850 ASSERT(CurrentToken() == Token::kWITH); 3850 ASSERT(CurrentToken() == Token::kWITH);
3851 3851
3852 // TODO(hausner): Remove this restriction. 3852 // TODO(hausner): Remove this restriction.
3853 if (super_type.arguments() != AbstractTypeArguments::null()) { 3853 if (super_type.arguments() != AbstractTypeArguments::null()) {
3854 ErrorMsg(super_type.token_pos(), 3854 ErrorMsg(super_type.token_pos(),
3855 "super class of mixin may not have type arguments"); 3855 "super class in mixin application may not have type arguments");
3856 } 3856 }
3857 3857
3858 AbstractType& mixin_type = AbstractType::Handle(); 3858 AbstractType& mixin_type = AbstractType::Handle();
3859 AbstractTypeArguments& mixin_type_arguments = 3859 AbstractTypeArguments& mixin_type_arguments =
3860 AbstractTypeArguments::Handle(); 3860 AbstractTypeArguments::Handle();
3861 Class& mixin_application = Class::Handle(); 3861 Class& mixin_application = Class::Handle();
3862 Type& mixin_application_type = Type::Handle(); 3862 Type& mixin_application_type = Type::Handle();
3863 Type& mixin_super_type = Type::Handle(super_type.raw()); 3863 Type& mixin_super_type = Type::Handle(super_type.raw());
3864 Array& mixin_application_interfaces = Array::Handle(); 3864 Array& mixin_application_interfaces = Array::Handle();
3865 do { 3865 do {
3866 ConsumeToken(); 3866 ConsumeToken();
3867 const intptr_t mixin_pos = TokenPos(); 3867 const intptr_t mixin_pos = TokenPos();
3868 mixin_type = ParseType(ClassFinalizer::kTryResolve); 3868 mixin_type = ParseType(ClassFinalizer::kTryResolve);
3869 if (mixin_type.IsTypeParameter()) { 3869 if (mixin_type.IsTypeParameter()) {
3870 ErrorMsg(mixin_pos, 3870 ErrorMsg(mixin_pos,
3871 "mixin type '%s' may not be a type parameter", 3871 "mixin type '%s' may not be a type parameter",
3872 String::Handle(mixin_type.UserVisibleName()).ToCString()); 3872 String::Handle(mixin_type.UserVisibleName()).ToCString());
3873 } 3873 }
3874 3874
3875 // The name of the mixin application class is a combination of 3875 // The name of the mixin application class is a combination of
3876 // the superclass and mixin class. 3876 // the superclass and mixin class.
3877 String& mixin_app_name = String::Handle(); 3877 String& mixin_app_name = String::Handle();
3878 mixin_app_name = mixin_super_type.Name(); 3878 mixin_app_name = mixin_super_type.ClassName();
3879 mixin_app_name = String::Concat(mixin_app_name, Symbols::Ampersand()); 3879 mixin_app_name = String::Concat(mixin_app_name, Symbols::Ampersand());
3880 mixin_app_name = String::Concat(mixin_app_name, 3880 mixin_app_name = String::Concat(mixin_app_name,
3881 String::Handle(mixin_type.Name())); 3881 String::Handle(mixin_type.ClassName()));
3882 mixin_app_name = Symbols::New(mixin_app_name); 3882 mixin_app_name = Symbols::New(mixin_app_name);
3883 3883
3884 mixin_application = Class::New(mixin_app_name, script_, mixin_pos); 3884 mixin_application = Class::New(mixin_app_name, script_, mixin_pos);
3885 mixin_application.set_super_type(mixin_super_type); 3885 mixin_application.set_super_type(mixin_super_type);
3886 mixin_application.set_mixin(Type::Cast(mixin_type)); 3886 mixin_application.set_mixin(Type::Cast(mixin_type));
3887 mixin_application.set_library(library_); 3887 mixin_application.set_library(library_);
3888 AddImplicitConstructor(mixin_application); 3888 AddImplicitConstructor(mixin_application);
3889 // Add the mixin type to the interfaces that the mixin application 3889 // Add the mixin type to the interfaces that the mixin application
3890 // class implements. This is necessary so that type tests work. 3890 // class implements. This is necessary so that type tests work.
3891 mixin_application_interfaces = Array::New(1); 3891 mixin_application_interfaces = Array::New(1);
(...skipping 6173 matching lines...) Expand 10 before | Expand all | Expand 10 after
10065 void Parser::SkipQualIdent() { 10065 void Parser::SkipQualIdent() {
10066 ASSERT(IsIdentifier()); 10066 ASSERT(IsIdentifier());
10067 ConsumeToken(); 10067 ConsumeToken();
10068 if (CurrentToken() == Token::kPERIOD) { 10068 if (CurrentToken() == Token::kPERIOD) {
10069 ConsumeToken(); // Consume the kPERIOD token. 10069 ConsumeToken(); // Consume the kPERIOD token.
10070 ExpectIdentifier("identifier expected after '.'"); 10070 ExpectIdentifier("identifier expected after '.'");
10071 } 10071 }
10072 } 10072 }
10073 10073
10074 } // namespace dart 10074 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698