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

Side by Side Diff: runtime/vm/parser.cc

Issue 2715243005: Print user-friendly name when parsing invalid redirecting constructor. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after
3116 receiver->set_invisible(true); 3116 receiver->set_invisible(true);
3117 ParseActualParameters(arguments, kAllowConst); 3117 ParseActualParameters(arguments, kAllowConst);
3118 receiver->set_invisible(false); 3118 receiver->set_invisible(false);
3119 // Resolve the constructor. 3119 // Resolve the constructor.
3120 const Function& redirect_ctor = 3120 const Function& redirect_ctor =
3121 Function::ZoneHandle(Z, cls.LookupConstructor(ctor_name)); 3121 Function::ZoneHandle(Z, cls.LookupConstructor(ctor_name));
3122 if (redirect_ctor.IsNull()) { 3122 if (redirect_ctor.IsNull()) {
3123 if (cls.LookupFactory(ctor_name) != Function::null()) { 3123 if (cls.LookupFactory(ctor_name) != Function::null()) {
3124 ReportError(call_pos, 3124 ReportError(call_pos,
3125 "redirection constructor '%s' must not be a factory", 3125 "redirection constructor '%s' must not be a factory",
3126 ctor_name.ToCString()); 3126 String::Handle(Z, String::ScrubName(ctor_name)).ToCString());
3127 } 3127 }
3128 ReportError(call_pos, "constructor '%s' not found", ctor_name.ToCString()); 3128 ReportError(call_pos, "constructor '%s' not found",
3129 String::Handle(Z, String::ScrubName(ctor_name)).ToCString());
3129 } 3130 }
3130 if (current_function().is_const() && !redirect_ctor.is_const()) { 3131 if (current_function().is_const() && !redirect_ctor.is_const()) {
3131 ReportError(call_pos, "redirection constructor '%s' must be const", 3132 ReportError(call_pos, "redirection constructor '%s' must be const",
3132 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString()); 3133 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString());
3133 } 3134 }
3134 String& error_message = String::Handle(Z); 3135 String& error_message = String::Handle(Z);
3135 if (!redirect_ctor.AreValidArguments(arguments->length(), arguments->names(), 3136 if (!redirect_ctor.AreValidArguments(arguments->length(), arguments->names(),
3136 &error_message)) { 3137 &error_message)) {
3137 ReportError(call_pos, "invalid arguments passed to constructor '%s': %s", 3138 ReportError(call_pos, "invalid arguments passed to constructor '%s': %s",
3138 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString(), 3139 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString(),
(...skipping 11935 matching lines...) Expand 10 before | Expand all | Expand 10 after
15074 const ArgumentListNode& function_args, 15075 const ArgumentListNode& function_args,
15075 const LocalVariable* temp_for_last_arg, 15076 const LocalVariable* temp_for_last_arg,
15076 bool is_super_invocation) { 15077 bool is_super_invocation) {
15077 UNREACHABLE(); 15078 UNREACHABLE();
15078 return NULL; 15079 return NULL;
15079 } 15080 }
15080 15081
15081 } // namespace dart 15082 } // namespace dart
15082 15083
15083 #endif // DART_PRECOMPILED_RUNTIME 15084 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698