Chromium Code Reviews| Index: runtime/vm/parser.cc |
| =================================================================== |
| --- runtime/vm/parser.cc (revision 21177) |
| +++ runtime/vm/parser.cc (working copy) |
| @@ -3071,14 +3071,19 @@ |
| ErrorMsg(member.name_pos, "factory name must be '%s'", |
| members->class_name().ToCString()); |
| } |
| + // Do not bypass class resolution by using current_class() directly, since |
| + // it may be a patch class. |
| const Object& result_type_class = Object::Handle( |
| UnresolvedClass::New(LibraryPrefix::Handle(), |
| *member.name, |
| member.name_pos)); |
| - // The type arguments of the result type are set during finalization. |
| - member.type = &Type::ZoneHandle(Type::New(result_type_class, |
| - TypeArguments::Handle(), |
| - member.name_pos)); |
| + // The type arguments of the result type are the type parameters of the |
| + // current class. Note that in the case of a patch class, they are copied |
| + // from the class being patched. |
| + member.type = &Type::ZoneHandle(Type::New( |
| + result_type_class, |
| + TypeArguments::Handle(current_class().type_parameters()), |
| + member.name_pos)); |
| } else if (member.has_static) { |
| ErrorMsg(member.name_pos, "constructor cannot be static"); |
| } |
| @@ -3301,6 +3306,11 @@ |
| class_name.ToCString(), |
| String::Handle(super_type.UserVisibleName()).ToCString()); |
| } |
| + if (super_type.IsDynamicType()) { |
| + ErrorMsg(type_pos, |
| + "class '%s' may not extend dynamic", |
|
hausner
2013/04/10 14:53:53
may not extend 'dynamic'? I'm fine either way.
regis
2013/04/10 16:31:33
Done.
|
| + class_name.ToCString()); |
| + } |
| if (CurrentToken() == Token::kWITH) { |
| super_type = ParseMixins(super_type); |
| } |
| @@ -3842,6 +3852,9 @@ |
| "type parameter '%s' may not be used in interface list", |
| String::Handle(interface.UserVisibleName()).ToCString()); |
| } |
| + if (interface.IsDynamicType()) { |
| + ErrorMsg(interface_pos, "dynamic may not be used in interface list"); |
|
hausner
2013/04/10 14:53:53
ditto
regis
2013/04/10 16:31:33
Done.
|
| + } |
| all_interfaces.Add(interface); |
| } while (CurrentToken() == Token::kCOMMA); |
| cls_interfaces = Array::MakeArray(all_interfaces); |