Chromium Code Reviews| Index: runtime/vm/parser.cc |
| diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
| index a63642dde91cc00bf71ce6a3d219739aa01d58c9..1029d573c3f10c53daafac01c58425f615c05882 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) { |
|
regis
2013/08/20 18:56:37
'final_mixin_application' is not an optimal name,
|
| 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()) { |
|
regis
2013/08/15 22:51:48
Parenthesis, please.
|
| + 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 |