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

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

Issue 2710363002: Fix VM crash when parsing a non-existing redirecting constructor (Closed)
Patch Set: Created 3 years, 10 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 | tests/language/regress_28217_test.dart » ('j') | 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 3103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3114 arguments->Add(implicit_argument); 3114 arguments->Add(implicit_argument);
3115 3115
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( 3124 ReportError(call_pos,
3125 call_pos, "redirection constructor '%s' must not be a factory", 3125 "redirection constructor '%s' must not be a factory",
3126 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString()); 3126 ctor_name.ToCString());
hausner 2017/02/26 18:30:27 I think you want to use a user-visible name here,
Florian Schneider 2017/02/27 18:14:50 Good point. I'll change it to use ScrubName instea
3127 } 3127 }
3128 ReportError(call_pos, "constructor '%s' not found", 3128 ReportError(call_pos, "constructor '%s' not found", ctor_name.ToCString());
3129 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString());
3130 } 3129 }
3131 if (current_function().is_const() && !redirect_ctor.is_const()) { 3130 if (current_function().is_const() && !redirect_ctor.is_const()) {
3132 ReportError(call_pos, "redirection constructor '%s' must be const", 3131 ReportError(call_pos, "redirection constructor '%s' must be const",
3133 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString()); 3132 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString());
3134 } 3133 }
3135 String& error_message = String::Handle(Z); 3134 String& error_message = String::Handle(Z);
3136 if (!redirect_ctor.AreValidArguments(arguments->length(), arguments->names(), 3135 if (!redirect_ctor.AreValidArguments(arguments->length(), arguments->names(),
3137 &error_message)) { 3136 &error_message)) {
3138 ReportError(call_pos, "invalid arguments passed to constructor '%s': %s", 3137 ReportError(call_pos, "invalid arguments passed to constructor '%s': %s",
3139 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString(), 3138 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString(),
(...skipping 11927 matching lines...) Expand 10 before | Expand all | Expand 10 after
15067 const ArgumentListNode& function_args, 15066 const ArgumentListNode& function_args,
15068 const LocalVariable* temp_for_last_arg, 15067 const LocalVariable* temp_for_last_arg,
15069 bool is_super_invocation) { 15068 bool is_super_invocation) {
15070 UNREACHABLE(); 15069 UNREACHABLE();
15071 return NULL; 15070 return NULL;
15072 } 15071 }
15073 15072
15074 } // namespace dart 15073 } // namespace dart
15075 15074
15076 #endif // DART_PRECOMPILED_RUNTIME 15075 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « no previous file | tests/language/regress_28217_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698