OLD | NEW |
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 3098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3109 AstNode* implicit_argument = new LoadLocalNode(call_pos, receiver); | 3109 AstNode* implicit_argument = new LoadLocalNode(call_pos, receiver); |
3110 arguments->Add(implicit_argument); | 3110 arguments->Add(implicit_argument); |
3111 | 3111 |
3112 receiver->set_invisible(true); | 3112 receiver->set_invisible(true); |
3113 ParseActualParameters(arguments, kAllowConst); | 3113 ParseActualParameters(arguments, kAllowConst); |
3114 receiver->set_invisible(false); | 3114 receiver->set_invisible(false); |
3115 // Resolve the constructor. | 3115 // Resolve the constructor. |
3116 const Function& redirect_ctor = Function::ZoneHandle(Z, | 3116 const Function& redirect_ctor = Function::ZoneHandle(Z, |
3117 cls.LookupConstructor(ctor_name)); | 3117 cls.LookupConstructor(ctor_name)); |
3118 if (redirect_ctor.IsNull()) { | 3118 if (redirect_ctor.IsNull()) { |
3119 ReportError(call_pos, "constructor '%s' not found", ctor_name.ToCString()); | 3119 ReportError(call_pos, "constructor '%s' not found", |
| 3120 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString()); |
| 3121 } |
| 3122 if (current_function().is_const() && !redirect_ctor.is_const()) { |
| 3123 ReportError(call_pos, |
| 3124 "redirection constructor '%s' must be const", |
| 3125 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString()); |
3120 } | 3126 } |
3121 String& error_message = String::Handle(Z); | 3127 String& error_message = String::Handle(Z); |
3122 if (!redirect_ctor.AreValidArguments(arguments->length(), | 3128 if (!redirect_ctor.AreValidArguments(arguments->length(), |
3123 arguments->names(), | 3129 arguments->names(), |
3124 &error_message)) { | 3130 &error_message)) { |
3125 ReportError(call_pos, | 3131 ReportError(call_pos, |
3126 "invalid arguments passed to constructor '%s': %s", | 3132 "invalid arguments passed to constructor '%s': %s", |
3127 ctor_name.ToCString(), | 3133 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString(), |
3128 error_message.ToCString()); | 3134 error_message.ToCString()); |
3129 } | 3135 } |
3130 current_block_->statements->Add( | 3136 current_block_->statements->Add( |
3131 new StaticCallNode(call_pos, redirect_ctor, arguments)); | 3137 new StaticCallNode(call_pos, redirect_ctor, arguments)); |
3132 } | 3138 } |
3133 | 3139 |
3134 | 3140 |
3135 SequenceNode* Parser::MakeImplicitConstructor(const Function& func) { | 3141 SequenceNode* Parser::MakeImplicitConstructor(const Function& func) { |
3136 ASSERT(func.IsGenerativeConstructor()); | 3142 ASSERT(func.IsGenerativeConstructor()); |
3137 ASSERT(func.Owner() == current_class().raw()); | 3143 ASSERT(func.Owner() == current_class().raw()); |
(...skipping 12010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15148 const ArgumentListNode& function_args, | 15154 const ArgumentListNode& function_args, |
15149 const LocalVariable* temp_for_last_arg, | 15155 const LocalVariable* temp_for_last_arg, |
15150 bool is_super_invocation) { | 15156 bool is_super_invocation) { |
15151 UNREACHABLE(); | 15157 UNREACHABLE(); |
15152 return NULL; | 15158 return NULL; |
15153 } | 15159 } |
15154 | 15160 |
15155 } // namespace dart | 15161 } // namespace dart |
15156 | 15162 |
15157 #endif // DART_PRECOMPILED_RUNTIME | 15163 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |