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

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

Issue 11712002: Remove NoSuchMethodErrorImplementation class and use NoSuchMethodError from core (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/parser.h ('k') | runtime/vm/symbols.h » ('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 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/compiler_stats.h" 10 #include "vm/compiler_stats.h"
(...skipping 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 ConsumeToken(); 2308 ConsumeToken();
2309 const intptr_t expr_pos = TokenPos(); 2309 const intptr_t expr_pos = TokenPos();
2310 AstNode* expr = ParseExpr(kAllowConst, kConsumeCascades); 2310 AstNode* expr = ParseExpr(kAllowConst, kConsumeCascades);
2311 ASSERT(expr != NULL); 2311 ASSERT(expr != NULL);
2312 current_block_->statements->Add(new ReturnNode(expr_pos, expr)); 2312 current_block_->statements->Add(new ReturnNode(expr_pos, expr));
2313 } else if (IsLiteral("native")) { 2313 } else if (IsLiteral("native")) {
2314 ParseNativeFunctionBlock(&params, func); 2314 ParseNativeFunctionBlock(&params, func);
2315 } else if (func.is_external()) { 2315 } else if (func.is_external()) {
2316 // Body of an external method contains a single throw. 2316 // Body of an external method contains a single throw.
2317 const String& function_name = String::ZoneHandle(func.name()); 2317 const String& function_name = String::ZoneHandle(func.name());
2318 // TODO(regis): For an instance function, pass the receiver to
2319 // NoSuchMethodError.
2318 current_block_->statements->Add( 2320 current_block_->statements->Add(
2319 ThrowNoSuchMethodError(TokenPos(), function_name)); 2321 ThrowNoSuchMethodError(TokenPos(), current_class(), function_name));
2320 } else { 2322 } else {
2321 UnexpectedToken(); 2323 UnexpectedToken();
2322 } 2324 }
2323 SequenceNode* body = CloseBlock(); 2325 SequenceNode* body = CloseBlock();
2324 current_block_->statements->Add(body); 2326 current_block_->statements->Add(body);
2325 innermost_function_ = saved_innermost_function.raw(); 2327 innermost_function_ = saved_innermost_function.raw();
2326 return CloseBlock(); 2328 return CloseBlock();
2327 } 2329 }
2328 2330
2329 2331
(...skipping 4261 matching lines...) Expand 10 before | Expand all | Expand 10 after
6591 // Malformed type error. 6593 // Malformed type error.
6592 const Error& error = Error::Handle(type.malformed_error()); 6594 const Error& error = Error::Handle(type.malformed_error());
6593 arguments->Add(new LiteralNode(type_pos, String::ZoneHandle( 6595 arguments->Add(new LiteralNode(type_pos, String::ZoneHandle(
6594 Symbols::New(error.ToErrorCString())))); 6596 Symbols::New(error.ToErrorCString()))));
6595 const String& cls_name = String::Handle(Symbols::TypeError()); 6597 const String& cls_name = String::Handle(Symbols::TypeError());
6596 const String& func_name = String::Handle(Symbols::ThrowNew()); 6598 const String& func_name = String::Handle(Symbols::ThrowNew());
6597 return MakeStaticCall(cls_name, func_name, arguments); 6599 return MakeStaticCall(cls_name, func_name, arguments);
6598 } 6600 }
6599 6601
6600 6602
6601 AstNode* Parser::ThrowNoSuchMethodError(intptr_t call_pos, const String& name) { 6603 // TODO(regis): Providing the argument values is not always feasible, since
6604 // evaluating them could throw an error.
6605 // Should NoSuchMethodError reflect the argument count and names instead of
6606 // argument values? Or should the spec specify a different evaluation order?
6607 AstNode* Parser::ThrowNoSuchMethodError(intptr_t call_pos,
6608 const Class& cls,
6609 const String& function_name) {
6602 ArgumentListNode* arguments = new ArgumentListNode(call_pos); 6610 ArgumentListNode* arguments = new ArgumentListNode(call_pos);
6603 // Location argument. 6611 // Object receiver.
6612 // TODO(regis): For now, we pass a class literal of the unresolved
6613 // method's owner, but this is not specified and will probably change.
6614 Type& type = Type::ZoneHandle(
6615 Type::New(cls, TypeArguments::Handle(), call_pos, Heap::kOld));
6616 type ^= ClassFinalizer::FinalizeType(
6617 current_class(), type, ClassFinalizer::kCanonicalize);
6618 arguments->Add(new LiteralNode(call_pos, type));
6619 // String memberName.
6604 arguments->Add(new LiteralNode( 6620 arguments->Add(new LiteralNode(
6605 call_pos, Integer::ZoneHandle(Integer::New(call_pos)))); 6621 call_pos, String::ZoneHandle(Symbols::New(function_name))));
6606 // Function name argument. 6622 // List arguments.
6607 arguments->Add(new LiteralNode( 6623 arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
6608 call_pos, String::ZoneHandle(Symbols::New(name)))); 6624 // List argumentNames.
6625 arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
6626 // List existingArgumentNames.
6627 arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
6609 const String& cls_name = String::Handle(Symbols::NoSuchMethodError()); 6628 const String& cls_name = String::Handle(Symbols::NoSuchMethodError());
6610 const String& func_name = String::Handle(Symbols::ThrowNew()); 6629 const String& func_name = String::Handle(Symbols::ThrowNew());
6611 return MakeStaticCall(cls_name, func_name, arguments); 6630 return MakeStaticCall(cls_name, func_name, arguments);
6612 } 6631 }
6613 6632
6614 6633
6615 AstNode* Parser::ParseBinaryExpr(int min_preced) { 6634 AstNode* Parser::ParseBinaryExpr(int min_preced) {
6616 TRACE_PARSER("ParseBinaryExpr"); 6635 TRACE_PARSER("ParseBinaryExpr");
6617 ASSERT(min_preced >= 4); 6636 ASSERT(min_preced >= 4);
6618 AstNode* left_operand = ParseUnaryExpr(); 6637 AstNode* left_operand = ParseUnaryExpr();
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
6887 } 6906 }
6888 6907
6889 6908
6890 // Ensure that the expression temp is allocated for nodes that may need it. 6909 // Ensure that the expression temp is allocated for nodes that may need it.
6891 AstNode* Parser::CreateAssignmentNode(AstNode* original, AstNode* rhs) { 6910 AstNode* Parser::CreateAssignmentNode(AstNode* original, AstNode* rhs) {
6892 AstNode* result = original->MakeAssignmentNode(rhs); 6911 AstNode* result = original->MakeAssignmentNode(rhs);
6893 if ((result == NULL) && original->IsTypeNode()) { 6912 if ((result == NULL) && original->IsTypeNode()) {
6894 const String& type_name = String::ZoneHandle( 6913 const String& type_name = String::ZoneHandle(
6895 original->AsTypeNode()->type().ClassName()); 6914 original->AsTypeNode()->type().ClassName());
6896 // TODO(tball): determine whether NoSuchMethod should be called instead. 6915 // TODO(tball): determine whether NoSuchMethod should be called instead.
6897 result = ThrowNoSuchMethodError(original->token_pos(), type_name); 6916 result = ThrowNoSuchMethodError(original->token_pos(),
6917 current_class(),
6918 type_name);
6898 } 6919 }
6899 if ((result != NULL) && 6920 if ((result != NULL) &&
6900 (result->IsStoreIndexedNode() || 6921 (result->IsStoreIndexedNode() ||
6901 result->IsInstanceSetterNode() || 6922 result->IsInstanceSetterNode() ||
6902 result->IsStaticSetterNode() || 6923 result->IsStaticSetterNode() ||
6903 result->IsStoreStaticFieldNode() || 6924 result->IsStoreStaticFieldNode() ||
6904 result->IsStoreLocalNode())) { 6925 result->IsStoreLocalNode())) {
6905 EnsureExpressionTemp(); 6926 EnsureExpressionTemp();
6906 } 6927 }
6907 return result; 6928 return result;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
7171 Class::ZoneHandle(cls.raw()), 7192 Class::ZoneHandle(cls.raw()),
7172 func_name); 7193 func_name);
7173 return new ClosureCallNode(call_pos, closure, arguments); 7194 return new ClosureCallNode(call_pos, closure, arguments);
7174 } 7195 }
7175 } else { 7196 } else {
7176 EnsureExpressionTemp(); 7197 EnsureExpressionTemp();
7177 closure = GenerateStaticFieldLookup(field, call_pos); 7198 closure = GenerateStaticFieldLookup(field, call_pos);
7178 return new ClosureCallNode(call_pos, closure, arguments); 7199 return new ClosureCallNode(call_pos, closure, arguments);
7179 } 7200 }
7180 // Could not resolve static method: throw a NoSuchMethodError. 7201 // Could not resolve static method: throw a NoSuchMethodError.
7181 return ThrowNoSuchMethodError(ident_pos, func_name); 7202 return ThrowNoSuchMethodError(ident_pos, cls, func_name);
7182 } 7203 }
7183 return new StaticCallNode(call_pos, func, arguments); 7204 return new StaticCallNode(call_pos, func, arguments);
7184 } 7205 }
7185 7206
7186 7207
7187 AstNode* Parser::ParseInstanceCall(AstNode* receiver, const String& func_name) { 7208 AstNode* Parser::ParseInstanceCall(AstNode* receiver, const String& func_name) {
7188 TRACE_PARSER("ParseInstanceCall"); 7209 TRACE_PARSER("ParseInstanceCall");
7189 const intptr_t call_pos = TokenPos(); 7210 const intptr_t call_pos = TokenPos();
7190 if (CurrentToken() != Token::kLPAREN) { 7211 if (CurrentToken() != Token::kLPAREN) {
7191 ErrorMsg(call_pos, "left parenthesis expected"); 7212 ErrorMsg(call_pos, "left parenthesis expected");
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
7243 String::ZoneHandle(Field::SetterName(field_name)); 7264 String::ZoneHandle(Field::SetterName(field_name));
7244 const int kNumArguments = 1; // value. 7265 const int kNumArguments = 1; // value.
7245 const Array& kNoArgumentNames = Array::Handle(); 7266 const Array& kNoArgumentNames = Array::Handle();
7246 func = Resolver::ResolveStatic(cls, 7267 func = Resolver::ResolveStatic(cls,
7247 setter_name, 7268 setter_name,
7248 kNumArguments, 7269 kNumArguments,
7249 kNoArgumentNames, 7270 kNoArgumentNames,
7250 Resolver::kIsQualified); 7271 Resolver::kIsQualified);
7251 if (func.IsNull()) { 7272 if (func.IsNull()) {
7252 // No field or explicit setter function, throw a NoSuchMethodError. 7273 // No field or explicit setter function, throw a NoSuchMethodError.
7253 return ThrowNoSuchMethodError(ident_pos, field_name); 7274 return ThrowNoSuchMethodError(ident_pos, cls, field_name);
7254 } 7275 }
7255 7276
7256 // Explicit setter function for the field found, field does not exist. 7277 // Explicit setter function for the field found, field does not exist.
7257 // Create a getter node first in case it is needed. If getter node 7278 // Create a getter node first in case it is needed. If getter node
7258 // is used as part of, e.g., "+=", and the explicit getter does not 7279 // is used as part of, e.g., "+=", and the explicit getter does not
7259 // exist, and error will be reported by the code generator. 7280 // exist, and error will be reported by the code generator.
7260 access = new StaticGetterNode(call_pos, 7281 access = new StaticGetterNode(call_pos,
7261 NULL, 7282 NULL,
7262 false, 7283 false,
7263 Class::ZoneHandle(cls.raw()), 7284 Class::ZoneHandle(cls.raw()),
(...skipping 20 matching lines...) Expand all
7284 getter_name, 7305 getter_name,
7285 kNumArguments, 7306 kNumArguments,
7286 kNoArgumentNames, 7307 kNoArgumentNames,
7287 Resolver::kIsQualified); 7308 Resolver::kIsQualified);
7288 if (func.IsNull()) { 7309 if (func.IsNull()) {
7289 // We might be referring to an implicit closure, check to see if 7310 // We might be referring to an implicit closure, check to see if
7290 // there is a function of the same name. 7311 // there is a function of the same name.
7291 func = cls.LookupStaticFunction(field_name); 7312 func = cls.LookupStaticFunction(field_name);
7292 if (func.IsNull()) { 7313 if (func.IsNull()) {
7293 // No field or explicit getter function, throw a NoSuchMethodError. 7314 // No field or explicit getter function, throw a NoSuchMethodError.
7294 return ThrowNoSuchMethodError(ident_pos, field_name); 7315 return ThrowNoSuchMethodError(ident_pos, cls, field_name);
7295 } 7316 }
7296 access = CreateImplicitClosureNode(func, call_pos, NULL); 7317 access = CreateImplicitClosureNode(func, call_pos, NULL);
7297 } else { 7318 } else {
7298 ASSERT(func.kind() != RawFunction::kConstImplicitGetter); 7319 ASSERT(func.kind() != RawFunction::kConstImplicitGetter);
7299 access = new StaticGetterNode(call_pos, 7320 access = new StaticGetterNode(call_pos,
7300 NULL, 7321 NULL,
7301 false, 7322 false,
7302 Class::ZoneHandle(cls.raw()), 7323 Class::ZoneHandle(cls.raw()),
7303 field_name); 7324 field_name);
7304 } 7325 }
(...skipping 14 matching lines...) Expand all
7319 if (primary->IsSuper()) { 7340 if (primary->IsSuper()) {
7320 return primary; 7341 return primary;
7321 } 7342 }
7322 // In a static method, evaluation of an unresolved identifier causes a 7343 // In a static method, evaluation of an unresolved identifier causes a
7323 // NoSuchMethodError to be thrown. 7344 // NoSuchMethodError to be thrown.
7324 // In an instance method, we convert this into a getter call 7345 // In an instance method, we convert this into a getter call
7325 // for a field (which may be defined in a subclass.) 7346 // for a field (which may be defined in a subclass.)
7326 String& name = String::CheckedZoneHandle(primary->primary().raw()); 7347 String& name = String::CheckedZoneHandle(primary->primary().raw());
7327 if (current_function().is_static() || 7348 if (current_function().is_static() ||
7328 current_function().IsInFactoryScope()) { 7349 current_function().IsInFactoryScope()) {
7329 return ThrowNoSuchMethodError(primary->token_pos(), name); 7350 return ThrowNoSuchMethodError(primary->token_pos(),
7351 current_class(),
7352 name);
7330 } else { 7353 } else {
7331 AstNode* receiver = LoadReceiver(primary->token_pos()); 7354 AstNode* receiver = LoadReceiver(primary->token_pos());
7332 return CallGetter(node->token_pos(), receiver, name); 7355 return CallGetter(node->token_pos(), receiver, name);
7333 } 7356 }
7334 } 7357 }
7335 return primary; 7358 return primary;
7336 } 7359 }
7337 7360
7338 7361
7339 AstNode* Parser::LoadClosure(PrimaryNode* primary) { 7362 AstNode* Parser::LoadClosure(PrimaryNode* primary) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
7456 } 7479 }
7457 selector = ParseInstanceCall(LoadReceiver(primary_pos), func_name); 7480 selector = ParseInstanceCall(LoadReceiver(primary_pos), func_name);
7458 } 7481 }
7459 } else if (primary->primary().IsString()) { 7482 } else if (primary->primary().IsString()) {
7460 // Primary is an unresolved name. 7483 // Primary is an unresolved name.
7461 if (primary->IsSuper()) { 7484 if (primary->IsSuper()) {
7462 ErrorMsg(primary->token_pos(), "illegal use of super"); 7485 ErrorMsg(primary->token_pos(), "illegal use of super");
7463 } 7486 }
7464 String& name = String::CheckedZoneHandle(primary->primary().raw()); 7487 String& name = String::CheckedZoneHandle(primary->primary().raw());
7465 if (current_function().is_static()) { 7488 if (current_function().is_static()) {
7466 selector = ThrowNoSuchMethodError(primary->token_pos(), name); 7489 selector = ThrowNoSuchMethodError(primary->token_pos(),
7490 current_class(),
7491 name);
7467 } else { 7492 } else {
7468 // Treat as call to unresolved (instance) method. 7493 // Treat as call to unresolved (instance) method.
7469 AstNode* receiver = LoadReceiver(primary->token_pos()); 7494 AstNode* receiver = LoadReceiver(primary->token_pos());
7470 selector = ParseInstanceCall(receiver, name); 7495 selector = ParseInstanceCall(receiver, name);
7471 } 7496 }
7472 } else if (primary->primary().IsClass()) { 7497 } else if (primary->primary().IsClass()) {
7473 ErrorMsg(left->token_pos(), 7498 ErrorMsg(left->token_pos(),
7474 "must use 'new' or 'const' to construct new instance"); 7499 "must use 'new' or 'const' to construct new instance");
7475 } else { 7500 } else {
7476 UNREACHABLE(); // Internal parser error. 7501 UNREACHABLE(); // Internal parser error.
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
8361 } 8386 }
8362 if (resolved->IsPrimaryNode()) { 8387 if (resolved->IsPrimaryNode()) {
8363 PrimaryNode* primary = resolved->AsPrimaryNode(); 8388 PrimaryNode* primary = resolved->AsPrimaryNode();
8364 if (primary->primary().IsString()) { 8389 if (primary->primary().IsString()) {
8365 // We got an unresolved name. If we are compiling a static 8390 // We got an unresolved name. If we are compiling a static
8366 // method, evaluation of an unresolved identifier causes a 8391 // method, evaluation of an unresolved identifier causes a
8367 // NoSuchMethodError to be thrown. In an instance method, we convert 8392 // NoSuchMethodError to be thrown. In an instance method, we convert
8368 // the unresolved name to an instance field access, since a 8393 // the unresolved name to an instance field access, since a
8369 // subclass might define a field with this name. 8394 // subclass might define a field with this name.
8370 if (current_function().is_static()) { 8395 if (current_function().is_static()) {
8371 resolved = ThrowNoSuchMethodError(ident_pos, ident); 8396 resolved = ThrowNoSuchMethodError(ident_pos, current_class(), ident);
8372 } else { 8397 } else {
8373 // Treat as call to unresolved instance field. 8398 // Treat as call to unresolved instance field.
8374 resolved = CallGetter(ident_pos, LoadReceiver(ident_pos), ident); 8399 resolved = CallGetter(ident_pos, LoadReceiver(ident_pos), ident);
8375 } 8400 }
8376 } else if (primary->primary().IsFunction()) { 8401 } else if (primary->primary().IsFunction()) {
8377 if (allow_closure_names) { 8402 if (allow_closure_names) {
8378 resolved = LoadClosure(primary); 8403 resolved = LoadClosure(primary);
8379 } else { 8404 } else {
8380 ErrorMsg(ident_pos, "illegal reference to method '%s'", 8405 ErrorMsg(ident_pos, "illegal reference to method '%s'",
8381 ident.ToCString()); 8406 ident.ToCString());
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
8965 BuildConstructorName(type_class_name, named_constructor); 8990 BuildConstructorName(type_class_name, named_constructor);
8966 Function& constructor = Function::ZoneHandle( 8991 Function& constructor = Function::ZoneHandle(
8967 type_class.LookupConstructor(constructor_name)); 8992 type_class.LookupConstructor(constructor_name));
8968 if (constructor.IsNull()) { 8993 if (constructor.IsNull()) {
8969 constructor = type_class.LookupFactory(constructor_name); 8994 constructor = type_class.LookupFactory(constructor_name);
8970 if (constructor.IsNull()) { 8995 if (constructor.IsNull()) {
8971 const String& external_constructor_name = 8996 const String& external_constructor_name =
8972 (named_constructor ? constructor_name : type_class_name); 8997 (named_constructor ? constructor_name : type_class_name);
8973 // Replace the type with a malformed type and compile a throw or report a 8998 // Replace the type with a malformed type and compile a throw or report a
8974 // compile-time error if the constructor is const. 8999 // compile-time error if the constructor is const.
8975 type = ClassFinalizer::NewFinalizedMalformedType(
8976 Error::Handle(), // No previous error.
8977 current_class(),
8978 call_pos,
8979 ClassFinalizer::kTryResolve, // No compile-time error.
8980 "class '%s' has no constructor or factory named '%s'",
8981 String::Handle(type_class.Name()).ToCString(),
8982 external_constructor_name.ToCString());
8983 if (is_const) { 9000 if (is_const) {
9001 type = ClassFinalizer::NewFinalizedMalformedType(
9002 Error::Handle(), // No previous error.
9003 current_class(),
9004 call_pos,
9005 ClassFinalizer::kTryResolve, // No compile-time error.
9006 "class '%s' has no constructor or factory named '%s'",
9007 String::Handle(type_class.Name()).ToCString(),
9008 external_constructor_name.ToCString());
8984 const Error& error = Error::Handle(type.malformed_error()); 9009 const Error& error = Error::Handle(type.malformed_error());
8985 ErrorMsg(error); 9010 ErrorMsg(error);
8986 } 9011 }
8987 return ThrowNoSuchMethodError(call_pos, external_constructor_name); 9012 return ThrowNoSuchMethodError(call_pos,
9013 type_class,
9014 external_constructor_name);
8988 } else if (constructor.IsRedirectingFactory()) { 9015 } else if (constructor.IsRedirectingFactory()) {
8989 Type& redirect_type = Type::Handle(constructor.RedirectionType()); 9016 Type& redirect_type = Type::Handle(constructor.RedirectionType());
8990 if (!redirect_type.IsMalformed() && !redirect_type.IsInstantiated()) { 9017 if (!redirect_type.IsMalformed() && !redirect_type.IsInstantiated()) {
8991 // The type arguments of the redirection type are instantiated from the 9018 // The type arguments of the redirection type are instantiated from the
8992 // type arguments of the parsed type of the 'new' or 'const' expression. 9019 // type arguments of the parsed type of the 'new' or 'const' expression.
8993 redirect_type ^= redirect_type.InstantiateFrom(type_arguments); 9020 redirect_type ^= redirect_type.InstantiateFrom(type_arguments);
8994 } 9021 }
8995 if (redirect_type.IsMalformed()) { 9022 if (redirect_type.IsMalformed()) {
8996 if (is_const) { 9023 if (is_const) {
8997 const Error& error = Error::Handle(redirect_type.malformed_error()); 9024 const Error& error = Error::Handle(redirect_type.malformed_error());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
9036 const String& external_constructor_name = 9063 const String& external_constructor_name =
9037 (named_constructor ? constructor_name : type_class_name); 9064 (named_constructor ? constructor_name : type_class_name);
9038 if (is_const) { 9065 if (is_const) {
9039 ErrorMsg(call_pos, 9066 ErrorMsg(call_pos,
9040 "invalid arguments passed to constructor '%s' " 9067 "invalid arguments passed to constructor '%s' "
9041 "for class '%s': %s", 9068 "for class '%s': %s",
9042 external_constructor_name.ToCString(), 9069 external_constructor_name.ToCString(),
9043 String::Handle(type_class.Name()).ToCString(), 9070 String::Handle(type_class.Name()).ToCString(),
9044 error_message.ToCString()); 9071 error_message.ToCString());
9045 } 9072 }
9046 return ThrowNoSuchMethodError(call_pos, external_constructor_name); 9073 return ThrowNoSuchMethodError(call_pos,
9074 type_class,
9075 external_constructor_name);
9047 } 9076 }
9048 9077
9049 // Return a throw in case of a malformed type or report a compile-time error 9078 // Return a throw in case of a malformed type or report a compile-time error
9050 // if the constructor is const. 9079 // if the constructor is const.
9051 if (type.IsMalformed()) { 9080 if (type.IsMalformed()) {
9052 if (is_const) { 9081 if (is_const) {
9053 const Error& error = Error::Handle(type.malformed_error()); 9082 const Error& error = Error::Handle(type.malformed_error());
9054 ErrorMsg(error); 9083 ErrorMsg(error);
9055 } 9084 }
9056 return ThrowTypeError(type_pos, type); 9085 return ThrowTypeError(type_pos, type);
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
9707 void Parser::SkipQualIdent() { 9736 void Parser::SkipQualIdent() {
9708 ASSERT(IsIdentifier()); 9737 ASSERT(IsIdentifier());
9709 ConsumeToken(); 9738 ConsumeToken();
9710 if (CurrentToken() == Token::kPERIOD) { 9739 if (CurrentToken() == Token::kPERIOD) {
9711 ConsumeToken(); // Consume the kPERIOD token. 9740 ConsumeToken(); // Consume the kPERIOD token.
9712 ExpectIdentifier("identifier expected after '.'"); 9741 ExpectIdentifier("identifier expected after '.'");
9713 } 9742 }
9714 } 9743 }
9715 9744
9716 } // namespace dart 9745 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698