| Index: runtime/vm/parser.cc
|
| diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
|
| index 247fbc7f70c8acc5bb4ed2b4059c983d954c397c..a35b7fb025041d6007838b03d3ad3ddd11af1a4c 100644
|
| --- a/runtime/vm/parser.cc
|
| +++ b/runtime/vm/parser.cc
|
| @@ -3588,7 +3588,7 @@ void Parser::ParseClassDeclaration(const GrowableObjectArray& pending_classes,
|
| String::Handle(super_type.UserVisibleName()).ToCString());
|
| }
|
| if (CurrentToken() == Token::kWITH) {
|
| - super_type = ParseMixins(super_type);
|
| + super_type = ParseMixins(super_type, Class::Handle());
|
| }
|
| } else {
|
| // No extends clause: implicitly extend Object, unless Object itself.
|
| @@ -3795,12 +3795,7 @@ void Parser::ParseMixinTypedef(const GrowableObjectArray& pending_classes) {
|
| if (CurrentToken() != Token::kWITH) {
|
| ErrorMsg("mixin application 'with Type' expected");
|
| }
|
| - type = ParseMixins(type);
|
| -
|
| - // TODO(hausner): treat the mixin application as an alias, not as a base
|
| - // class whose super class is the mixin application!
|
| - mixin_application.set_super_type(type);
|
| - mixin_application.set_is_synthesized_class();
|
| + type = ParseMixins(type, mixin_application);
|
|
|
| // This mixin application typedef needs an implicit constructor, but it is
|
| // too early to call 'AddImplicitConstructor(mixin_application)' here,
|
| @@ -4167,7 +4162,8 @@ void Parser::ParseInterfaceList(const Class& cls) {
|
| }
|
|
|
|
|
| -RawAbstractType* Parser::ParseMixins(const AbstractType& super_type) {
|
| +RawAbstractType* Parser::ParseMixins(const AbstractType& super_type,
|
| + const Class& final_mixin_application) {
|
| TRACE_PARSER("ParseMixins");
|
| ASSERT(CurrentToken() == Token::kWITH);
|
|
|
| @@ -4194,17 +4190,21 @@ RawAbstractType* Parser::ParseMixins(const AbstractType& super_type) {
|
|
|
| // The name of the mixin application class is a combination of
|
| // the superclass and mixin class.
|
| - String& mixin_app_name = String::Handle();
|
| - mixin_app_name = mixin_super_type.ClassName();
|
| - mixin_app_name = String::Concat(mixin_app_name, Symbols::Ampersand());
|
| - mixin_app_name = String::Concat(mixin_app_name,
|
| + if (CurrentToken() != Token::kCOMMA && !final_mixin_application.IsNull()) {
|
| + mixin_application = final_mixin_application.raw();
|
| + } else {
|
| + String& mixin_app_name = String::Handle();
|
| + mixin_app_name = mixin_super_type.ClassName();
|
| + mixin_app_name = String::Concat(mixin_app_name, Symbols::Ampersand());
|
| + mixin_app_name = String::Concat(mixin_app_name,
|
| String::Handle(mixin_type.ClassName()));
|
| - mixin_app_name = Symbols::New(mixin_app_name);
|
| + mixin_app_name = Symbols::New(mixin_app_name);
|
|
|
| - mixin_application = Class::New(mixin_app_name, script_, mixin_pos);
|
| + mixin_application = Class::New(mixin_app_name, script_, mixin_pos);
|
| + mixin_application.set_library(library_);
|
| + }
|
| mixin_application.set_super_type(mixin_super_type);
|
| mixin_application.set_mixin(Type::Cast(mixin_type));
|
| - mixin_application.set_library(library_);
|
| mixin_application.set_is_synthesized_class();
|
|
|
| // Add the mixin type to the interfaces that the mixin application
|
|
|