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

Unified Diff: runtime/vm/parser.cc

Issue 2439593003: Add check for constness in constructor redirection (Closed)
Patch Set: Add regression test Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index a4c7558dd8818b1d8334208eb1142bb2bacfc345..868c27bf54dea1be6e5fe128767128e497a9a605 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -3116,7 +3116,13 @@ void Parser::ParseConstructorRedirection(const Class& cls,
const Function& redirect_ctor = Function::ZoneHandle(Z,
cls.LookupConstructor(ctor_name));
if (redirect_ctor.IsNull()) {
- ReportError(call_pos, "constructor '%s' not found", ctor_name.ToCString());
+ ReportError(call_pos, "constructor '%s' not found",
+ String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString());
+ }
+ if (current_function().is_const() && !redirect_ctor.is_const()) {
+ ReportError(call_pos,
+ "redirection constructor '%s' must be const",
+ String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString());
}
String& error_message = String::Handle(Z);
if (!redirect_ctor.AreValidArguments(arguments->length(),
@@ -3124,7 +3130,7 @@ void Parser::ParseConstructorRedirection(const Class& cls,
&error_message)) {
ReportError(call_pos,
"invalid arguments passed to constructor '%s': %s",
- ctor_name.ToCString(),
+ String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString(),
error_message.ToCString());
}
current_block_->statements->Add(
« no previous file with comments | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698