| Index: runtime/vm/class_finalizer.cc
|
| diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
|
| index 184772653046a9864fa61350381d2103eb188b76..67b3683c453ca9557eef2892b74e9aaf03e32e3a 100644
|
| --- a/runtime/vm/class_finalizer.cc
|
| +++ b/runtime/vm/class_finalizer.cc
|
| @@ -2210,12 +2210,23 @@ void ClassFinalizer::ApplyMixinMembers(const Class& cls) {
|
| const intptr_t num_functions = functions.Length();
|
| for (intptr_t i = 0; i < num_functions; i++) {
|
| func ^= functions.At(i);
|
| - if (func.IsGenerativeConstructor()) {
|
| + if (func.IsFactory() || func.IsGenerativeConstructor()) {
|
| // A mixin class must not have explicit constructors.
|
| if (!func.IsImplicitConstructor()) {
|
| - ReportError(cls, cls.token_pos(),
|
| - "mixin class '%s' must not have constructors\n",
|
| - String::Handle(zone, mixin_cls.Name()).ToCString());
|
| + const char* ctr_kind = func.IsFactory() ? "factory" : "constructor";
|
| + const Script& script = Script::Handle(cls.script());
|
| + const Error& error = Error::Handle(
|
| + LanguageError::NewFormatted(Error::Handle(),
|
| + script, func.token_pos(), Report::AtLocation,
|
| + Report::kError, Heap::kNew,
|
| + "%s '%s' is illegal in mixin class %s",
|
| + ctr_kind,
|
| + String::Handle(func.PrettyName()).ToCString(),
|
| + String::Handle(zone, mixin_cls.Name()).ToCString()));
|
| +
|
| + ReportErrors(error, cls, cls.token_pos(),
|
| + "mixin class '%s' must not have constructors",
|
| + String::Handle(zone, mixin_cls.Name()).ToCString());
|
| }
|
| continue; // Skip the implicit constructor.
|
| }
|
|
|