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

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

Issue 2859673002: Pass type argument vector to generic functions (if --reify-generic-functions is (Closed)
Patch Set: Created 3 years, 7 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
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 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 return CloseBlock(); 1550 return CloseBlock();
1551 } 1551 }
1552 1552
1553 1553
1554 SequenceNode* Parser::ParseImplicitClosure(const Function& func) { 1554 SequenceNode* Parser::ParseImplicitClosure(const Function& func) {
1555 TRACE_PARSER("ParseImplicitClosure"); 1555 TRACE_PARSER("ParseImplicitClosure");
1556 TokenPosition token_pos = func.token_pos(); 1556 TokenPosition token_pos = func.token_pos();
1557 1557
1558 OpenFunctionBlock(func); 1558 OpenFunctionBlock(func);
1559 1559
1560 const Function& parent = Function::Handle(func.parent_function());
1561 intptr_t type_args_len = 0; // Length of type args vector passed to parent.
1562 LocalVariable* type_args_var = NULL;
1560 if (FLAG_reify_generic_functions) { 1563 if (FLAG_reify_generic_functions) {
1561 // The parent function of an implicit closure is the original function, i.e. 1564 // The parent function of an implicit closure is the original function, i.e.
1562 // non-closurized. It is not an enclosing function in the usual sense of a 1565 // non-closurized. It is not an enclosing function in the usual sense of a
1563 // parent function. Do not set parent_type_arguments() in parsed_function_. 1566 // parent function. Do not set parent_type_arguments() in parsed_function_.
1564 ASSERT(func.IsGeneric() == func.HasGenericParent()); 1567 ASSERT(func.IsGeneric() == parent.IsGeneric());
1565 1568
1566 if (func.IsGeneric()) { 1569 if (func.IsGeneric()) {
1570 type_args_len = func.NumTypeParameters();
1567 // Insert function type arguments variable to scope. 1571 // Insert function type arguments variable to scope.
1568 LocalVariable* function_type_arguments = new (Z) LocalVariable( 1572 type_args_var = new (Z) LocalVariable(
1569 TokenPosition::kNoSource, TokenPosition::kNoSource, 1573 TokenPosition::kNoSource, TokenPosition::kNoSource,
1570 Symbols::FunctionTypeArgumentsVar(), Object::dynamic_type()); 1574 Symbols::FunctionTypeArgumentsVar(), Object::dynamic_type());
1571 current_block_->scope->AddVariable(function_type_arguments); 1575 current_block_->scope->AddVariable(type_args_var);
1572 ASSERT(FunctionLevel() == 0); 1576 ASSERT(FunctionLevel() == 0);
1573 parsed_function_->set_function_type_arguments(function_type_arguments); 1577 parsed_function_->set_function_type_arguments(type_args_var);
1574 } 1578 }
1575 } 1579 }
1576 1580
1577 // TODO(regis): Pass the function type arguments if func is generic.
1578 ParamList params; 1581 ParamList params;
1579 params.AddFinalParameter(token_pos, &Symbols::ClosureParameter(), 1582 params.AddFinalParameter(token_pos, &Symbols::ClosureParameter(),
1580 &Object::dynamic_type()); 1583 &Object::dynamic_type());
1581 1584
1582 const Function& parent = Function::Handle(func.parent_function());
1583 if (parent.IsImplicitSetterFunction()) { 1585 if (parent.IsImplicitSetterFunction()) {
1584 const TokenPosition ident_pos = func.token_pos(); 1586 const TokenPosition ident_pos = func.token_pos();
1585 ASSERT(IsIdentifier()); 1587 ASSERT(IsIdentifier());
1586 params.AddFinalParameter(ident_pos, &Symbols::Value(), 1588 params.AddFinalParameter(ident_pos, &Symbols::Value(),
1587 &Object::dynamic_type()); 1589 &Object::dynamic_type());
1588 ASSERT(func.num_fixed_parameters() == 2); // closure, value. 1590 ASSERT(func.num_fixed_parameters() == 2); // closure, value.
1589 } else if (!parent.IsGetterFunction() && !parent.IsImplicitGetterFunction()) { 1591 } else if (!parent.IsGetterFunction() && !parent.IsImplicitGetterFunction()) {
1590 // NOTE: For the `kernel -> flowgraph` we don't use the parser. 1592 // NOTE: For the `kernel -> flowgraph` we don't use the parser.
1591 if (parent.kernel_function() == NULL) { 1593 if (parent.kernel_function() == NULL) {
1592 SkipFunctionPreamble(); 1594 SkipFunctionPreamble();
1593 const bool use_function_type_syntax = false; 1595 const bool use_function_type_syntax = false;
1594 const bool allow_explicit_default_values = true; 1596 const bool allow_explicit_default_values = true;
1595 const bool evaluate_metadata = false; 1597 const bool evaluate_metadata = false;
1596 ParseFormalParameterList(use_function_type_syntax, 1598 ParseFormalParameterList(use_function_type_syntax,
1597 allow_explicit_default_values, evaluate_metadata, 1599 allow_explicit_default_values, evaluate_metadata,
1598 &params); 1600 &params);
1599 FinalizeFormalParameterTypes(&params); 1601 FinalizeFormalParameterTypes(&params);
1600 SetupDefaultsForOptionalParams(params); 1602 SetupDefaultsForOptionalParams(params);
1601 } 1603 }
1602 } 1604 }
1603 1605
1604 // Populate function scope with the formal parameters. 1606 // Populate function scope with the formal parameters.
1605 LocalScope* scope = current_block_->scope; 1607 LocalScope* scope = current_block_->scope;
1606 AddFormalParamsToScope(&params, scope); 1608 AddFormalParamsToScope(&params, scope);
1607 1609
1608 ArgumentListNode* func_args = new ArgumentListNode(token_pos); 1610 ArgumentListNode* func_args =
1611 new ArgumentListNode(token_pos, type_args_var, type_args_len);
1609 if (!func.is_static()) { 1612 if (!func.is_static()) {
1610 func_args->Add(LoadReceiver(token_pos)); 1613 func_args->Add(LoadReceiver(token_pos));
1611 } 1614 }
1612 // Skip implicit parameter at 0. 1615 // Skip implicit parameter at 0.
1613 for (intptr_t i = 1; i < func.NumParameters(); ++i) { 1616 for (intptr_t i = 1; i < func.NumParameters(); ++i) {
1614 func_args->Add(new LoadLocalNode(token_pos, scope->VariableAt(i))); 1617 func_args->Add(new LoadLocalNode(token_pos, scope->VariableAt(i)));
1615 } 1618 }
1616 1619
1617 if (func.HasOptionalNamedParameters()) { 1620 if (func.HasOptionalNamedParameters()) {
1618 // TODO(srdjan): Must allocate array in old space, since it 1621 // TODO(srdjan): Must allocate array in old space, since it
(...skipping 29 matching lines...) Expand all
1648 } else if (!parent.is_static()) { 1651 } else if (!parent.is_static()) {
1649 ASSERT(Isolate::Current()->HasAttemptedReload()); 1652 ASSERT(Isolate::Current()->HasAttemptedReload());
1650 // If a subsequent reload reintroduces the target in the middle of the 1653 // If a subsequent reload reintroduces the target in the middle of the
1651 // Invocation object being constructed, we won't be able to successfully 1654 // Invocation object being constructed, we won't be able to successfully
1652 // deopt because the generated AST will change. 1655 // deopt because the generated AST will change.
1653 func.SetIsOptimizable(false); 1656 func.SetIsOptimizable(false);
1654 1657
1655 ArgumentListNode* arguments = BuildNoSuchMethodArguments( 1658 ArgumentListNode* arguments = BuildNoSuchMethodArguments(
1656 token_pos, func_name, *func_args, NULL, false); 1659 token_pos, func_name, *func_args, NULL, false);
1657 const intptr_t kNumArguments = 2; // Receiver, InvocationMirror. 1660 const intptr_t kNumArguments = 2; // Receiver, InvocationMirror.
1658 ArgumentsDescriptor args_desc( 1661 ArgumentsDescriptor args_desc(Array::Handle(
1659 Array::Handle(Z, ArgumentsDescriptor::New(kNumArguments))); 1662 Z, ArgumentsDescriptor::New(type_args_len, kNumArguments)));
1660 Function& no_such_method = 1663 Function& no_such_method =
1661 Function::ZoneHandle(Z, Resolver::ResolveDynamicForReceiverClass( 1664 Function::ZoneHandle(Z, Resolver::ResolveDynamicForReceiverClass(
1662 owner, Symbols::NoSuchMethod(), args_desc)); 1665 owner, Symbols::NoSuchMethod(), args_desc));
1663 if (no_such_method.IsNull()) { 1666 if (no_such_method.IsNull()) {
1664 // If noSuchMethod(i) is not found, call Object:noSuchMethod. 1667 // If noSuchMethod(i) is not found, call Object:noSuchMethod.
1665 no_such_method ^= Resolver::ResolveDynamicForReceiverClass( 1668 no_such_method ^= Resolver::ResolveDynamicForReceiverClass(
1666 Class::Handle(Z, I->object_store()->object_class()), 1669 Class::Handle(Z, I->object_store()->object_class()),
1667 Symbols::NoSuchMethod(), args_desc); 1670 Symbols::NoSuchMethod(), args_desc);
1668 } 1671 }
1669 call = new StaticCallNode(token_pos, no_such_method, arguments); 1672 call = new StaticCallNode(token_pos, no_such_method, arguments);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 Array::ZoneHandle(Z, Array::New(desc.NamedCount(), Heap::kOld)); 1793 Array::ZoneHandle(Z, Array::New(desc.NamedCount(), Heap::kOld));
1791 for (intptr_t i = 0; i < arg_names.Length(); ++i) { 1794 for (intptr_t i = 0; i < arg_names.Length(); ++i) {
1792 arg_names.SetAt(i, String::Handle(Z, desc.NameAt(i))); 1795 arg_names.SetAt(i, String::Handle(Z, desc.NameAt(i)));
1793 } 1796 }
1794 func_args->set_names(arg_names); 1797 func_args->set_names(arg_names);
1795 } 1798 }
1796 1799
1797 const String& func_name = String::ZoneHandle(Z, func.name()); 1800 const String& func_name = String::ZoneHandle(Z, func.name());
1798 ArgumentListNode* arguments = 1801 ArgumentListNode* arguments =
1799 BuildNoSuchMethodArguments(token_pos, func_name, *func_args, NULL, false); 1802 BuildNoSuchMethodArguments(token_pos, func_name, *func_args, NULL, false);
1803 const intptr_t kTypeArgsLen = 0;
1800 const intptr_t kNumArguments = 2; // Receiver, InvocationMirror. 1804 const intptr_t kNumArguments = 2; // Receiver, InvocationMirror.
1801 ArgumentsDescriptor args_desc( 1805 ArgumentsDescriptor args_desc(
1802 Array::Handle(Z, ArgumentsDescriptor::New(kNumArguments))); 1806 Array::Handle(Z, ArgumentsDescriptor::New(kTypeArgsLen, kNumArguments)));
1803 Function& no_such_method = Function::ZoneHandle( 1807 Function& no_such_method = Function::ZoneHandle(
1804 Z, 1808 Z,
1805 Resolver::ResolveDynamicForReceiverClass( 1809 Resolver::ResolveDynamicForReceiverClass(
1806 Class::Handle(Z, func.Owner()), Symbols::NoSuchMethod(), args_desc)); 1810 Class::Handle(Z, func.Owner()), Symbols::NoSuchMethod(), args_desc));
1807 if (no_such_method.IsNull()) { 1811 if (no_such_method.IsNull()) {
1808 // If noSuchMethod(i) is not found, call Object:noSuchMethod. 1812 // If noSuchMethod(i) is not found, call Object:noSuchMethod.
1809 no_such_method ^= Resolver::ResolveDynamicForReceiverClass( 1813 no_such_method ^= Resolver::ResolveDynamicForReceiverClass(
1810 Class::Handle(Z, I->object_store()->object_class()), 1814 Class::Handle(Z, I->object_store()->object_class()),
1811 Symbols::NoSuchMethod(), args_desc); 1815 Symbols::NoSuchMethod(), args_desc);
1812 } 1816 }
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 bool resolve_getter, 2375 bool resolve_getter,
2372 bool* is_no_such_method) { 2376 bool* is_no_such_method) {
2373 const Class& super_class = Class::Handle(Z, current_class().SuperClass()); 2377 const Class& super_class = Class::Handle(Z, current_class().SuperClass());
2374 if (super_class.IsNull()) { 2378 if (super_class.IsNull()) {
2375 ReportError(token_pos, "class '%s' does not have a superclass", 2379 ReportError(token_pos, "class '%s' does not have a superclass",
2376 String::Handle(Z, current_class().Name()).ToCString()); 2380 String::Handle(Z, current_class().Name()).ToCString());
2377 } 2381 }
2378 Function& super_func = Function::Handle( 2382 Function& super_func = Function::Handle(
2379 Z, Resolver::ResolveDynamicAnyArgs(Z, super_class, name)); 2383 Z, Resolver::ResolveDynamicAnyArgs(Z, super_class, name));
2380 if (!super_func.IsNull() && 2384 if (!super_func.IsNull() &&
2381 !super_func.AreValidArguments(arguments->length(), arguments->names(), 2385 !super_func.AreValidArguments(arguments->type_args_len(),
2386 arguments->length(), arguments->names(),
2382 NULL)) { 2387 NULL)) {
2383 super_func = Function::null(); 2388 super_func = Function::null();
2384 } else if (super_func.IsNull() && resolve_getter) { 2389 } else if (super_func.IsNull() && resolve_getter) {
2385 const String& getter_name = 2390 const String& getter_name =
2386 String::ZoneHandle(Z, Field::LookupGetterSymbol(name)); 2391 String::ZoneHandle(Z, Field::LookupGetterSymbol(name));
2387 if (!getter_name.IsNull()) { 2392 if (!getter_name.IsNull()) {
2388 super_func = Resolver::ResolveDynamicAnyArgs(Z, super_class, getter_name); 2393 super_func = Resolver::ResolveDynamicAnyArgs(Z, super_class, getter_name);
2389 ASSERT(super_func.IsNull() || 2394 ASSERT(super_func.IsNull() ||
2390 (super_func.kind() != RawFunction::kImplicitStaticFinalGetter)); 2395 (super_func.kind() != RawFunction::kImplicitStaticFinalGetter));
2391 } 2396 }
(...skipping 12 matching lines...) Expand all
2404 2409
2405 StaticCallNode* Parser::BuildInvocationMirrorAllocation( 2410 StaticCallNode* Parser::BuildInvocationMirrorAllocation(
2406 TokenPosition call_pos, 2411 TokenPosition call_pos,
2407 const String& function_name, 2412 const String& function_name,
2408 const ArgumentListNode& function_args, 2413 const ArgumentListNode& function_args,
2409 const LocalVariable* temp_for_last_arg, 2414 const LocalVariable* temp_for_last_arg,
2410 bool is_super_invocation) { 2415 bool is_super_invocation) {
2411 const TokenPosition args_pos = function_args.token_pos(); 2416 const TokenPosition args_pos = function_args.token_pos();
2412 // Build arguments to the call to the static 2417 // Build arguments to the call to the static
2413 // InvocationMirror._allocateInvocationMirror method. 2418 // InvocationMirror._allocateInvocationMirror method.
2419 const intptr_t type_args_len = function_args.type_args_len();
2420 const intptr_t args_count =
2421 function_args.length() - (type_args_len > 0 ? 1 : 0);
2414 ArgumentListNode* arguments = new ArgumentListNode(args_pos); 2422 ArgumentListNode* arguments = new ArgumentListNode(args_pos);
2415 // The first argument is the original function name. 2423 // The first argument is the original function name.
2416 arguments->Add(new LiteralNode(args_pos, function_name)); 2424 arguments->Add(new LiteralNode(args_pos, function_name));
2417 // The second argument is the arguments descriptor of the original function. 2425 // The second argument is the arguments descriptor of the original function.
2418 const Array& args_descriptor = Array::ZoneHandle( 2426 const Array& args_descriptor = Array::ZoneHandle(ArgumentsDescriptor::New(
2419 ArgumentsDescriptor::New(function_args.length(), function_args.names())); 2427 type_args_len, args_count, function_args.names()));
2420 arguments->Add(new LiteralNode(args_pos, args_descriptor)); 2428 arguments->Add(new LiteralNode(args_pos, args_descriptor));
2421 // The third argument is an array containing the original function arguments, 2429 // The third argument is an array containing the original function arguments,
2422 // including the receiver. 2430 // including the function type arguments and the receiver.
2423 ArrayNode* args_array = 2431 ArrayNode* args_array =
2424 new ArrayNode(args_pos, Type::ZoneHandle(Type::ArrayType())); 2432 new ArrayNode(args_pos, Type::ZoneHandle(Type::ArrayType()));
2425 for (intptr_t i = 0; i < function_args.length(); i++) { 2433 for (intptr_t i = 0; i < function_args.length(); i++) {
2426 AstNode* arg = function_args.NodeAt(i); 2434 AstNode* arg = function_args.NodeAt(i);
2427 if ((temp_for_last_arg != NULL) && (i == function_args.length() - 1)) { 2435 if ((temp_for_last_arg != NULL) && (i == function_args.length() - 1)) {
2428 LetNode* store_arg = new LetNode(arg->token_pos()); 2436 LetNode* store_arg = new LetNode(arg->token_pos());
2429 store_arg->AddNode( 2437 store_arg->AddNode(
2430 new StoreLocalNode(arg->token_pos(), temp_for_last_arg, arg)); 2438 new StoreLocalNode(arg->token_pos(), temp_for_last_arg, arg));
2431 store_arg->AddNode( 2439 store_arg->AddNode(
2432 new LoadLocalNode(arg->token_pos(), temp_for_last_arg)); 2440 new LoadLocalNode(arg->token_pos(), temp_for_last_arg));
(...skipping 15 matching lines...) Expand all
2448 return new StaticCallNode(call_pos, allocation_function, arguments); 2456 return new StaticCallNode(call_pos, allocation_function, arguments);
2449 } 2457 }
2450 2458
2451 2459
2452 ArgumentListNode* Parser::BuildNoSuchMethodArguments( 2460 ArgumentListNode* Parser::BuildNoSuchMethodArguments(
2453 TokenPosition call_pos, 2461 TokenPosition call_pos,
2454 const String& function_name, 2462 const String& function_name,
2455 const ArgumentListNode& function_args, 2463 const ArgumentListNode& function_args,
2456 const LocalVariable* temp_for_last_arg, 2464 const LocalVariable* temp_for_last_arg,
2457 bool is_super_invocation) { 2465 bool is_super_invocation) {
2458 ASSERT(function_args.length() >= 1); // The receiver is the first argument. 2466 const intptr_t receiver_idx = function_args.type_args_len() > 0 ? 1 : 0;
2467 ASSERT(function_args.length() > receiver_idx);
2459 const TokenPosition args_pos = function_args.token_pos(); 2468 const TokenPosition args_pos = function_args.token_pos();
2460 ArgumentListNode* arguments = new ArgumentListNode(args_pos); 2469 ArgumentListNode* arguments = new ArgumentListNode(args_pos);
2461 arguments->Add(function_args.NodeAt(0)); 2470 arguments->Add(function_args.NodeAt(receiver_idx));
2462 // The second argument is the invocation mirror. 2471 // The second argument is the invocation mirror.
2463 arguments->Add( 2472 arguments->Add(
2464 BuildInvocationMirrorAllocation(call_pos, function_name, function_args, 2473 BuildInvocationMirrorAllocation(call_pos, function_name, function_args,
2465 temp_for_last_arg, is_super_invocation)); 2474 temp_for_last_arg, is_super_invocation));
2466 return arguments; 2475 return arguments;
2467 } 2476 }
2468 2477
2469 2478
2470 AstNode* Parser::ParseSuperCall(const String& function_name) { 2479 AstNode* Parser::ParseSuperCall(const String& function_name,
2480 const TypeArguments& func_type_args) {
2471 TRACE_PARSER("ParseSuperCall"); 2481 TRACE_PARSER("ParseSuperCall");
2472 ASSERT(CurrentToken() == Token::kLPAREN); 2482 ASSERT(CurrentToken() == Token::kLPAREN);
2473 const TokenPosition supercall_pos = TokenPos(); 2483 const TokenPosition supercall_pos = TokenPos();
2474 2484
2475 // 'this' parameter is the first argument to super call. 2485 // 'this' parameter is the first argument to super call (after the type args).
2476 ArgumentListNode* arguments = new ArgumentListNode(supercall_pos); 2486 ArgumentListNode* arguments =
2487 new ArgumentListNode(supercall_pos, func_type_args);
2477 AstNode* receiver = LoadReceiver(supercall_pos); 2488 AstNode* receiver = LoadReceiver(supercall_pos);
2478 arguments->Add(receiver); 2489 arguments->Add(receiver);
2479 ParseActualParameters(arguments, kAllowConst); 2490 ParseActualParameters(arguments, Object::null_type_arguments(), kAllowConst);
2480 2491
2481 const bool kResolveGetter = true; 2492 const bool kResolveGetter = true;
2482 bool is_no_such_method = false; 2493 bool is_no_such_method = false;
2483 const Function& super_function = Function::ZoneHandle( 2494 const Function& super_function = Function::ZoneHandle(
2484 Z, GetSuperFunction(supercall_pos, function_name, arguments, 2495 Z, GetSuperFunction(supercall_pos, function_name, arguments,
2485 kResolveGetter, &is_no_such_method)); 2496 kResolveGetter, &is_no_such_method));
2486 if (super_function.IsGetterFunction() || 2497 if (super_function.IsGetterFunction() ||
2487 super_function.IsImplicitGetterFunction()) { 2498 super_function.IsImplicitGetterFunction()) {
2488 const Class& super_class = 2499 const Class& super_class =
2489 Class::ZoneHandle(Z, current_class().SuperClass()); 2500 Class::ZoneHandle(Z, current_class().SuperClass());
2490 AstNode* closure = new StaticGetterNode( 2501 AstNode* closure = new StaticGetterNode(
2491 supercall_pos, LoadReceiver(supercall_pos), super_class, function_name); 2502 supercall_pos, LoadReceiver(supercall_pos), super_class, function_name);
2492 // 'this' is not passed as parameter to the closure. 2503 // 'this' is not passed as parameter to the closure.
2493 ArgumentListNode* closure_arguments = new ArgumentListNode(supercall_pos); 2504 ArgumentListNode* closure_arguments =
2505 new ArgumentListNode(supercall_pos, func_type_args);
2494 for (int i = 1; i < arguments->length(); i++) { 2506 for (int i = 1; i < arguments->length(); i++) {
2495 closure_arguments->Add(arguments->NodeAt(i)); 2507 closure_arguments->Add(arguments->NodeAt(i));
2496 } 2508 }
2497 return BuildClosureCall(supercall_pos, closure, closure_arguments); 2509 return BuildClosureCall(supercall_pos, closure, closure_arguments);
2498 } 2510 }
2499 if (is_no_such_method) { 2511 if (is_no_such_method) {
2500 arguments = BuildNoSuchMethodArguments(supercall_pos, function_name, 2512 arguments = BuildNoSuchMethodArguments(supercall_pos, function_name,
2501 *arguments, NULL, true); 2513 *arguments, NULL, true);
2502 } 2514 }
2503 return new StaticCallNode(supercall_pos, super_function, arguments); 2515 return new StaticCallNode(supercall_pos, super_function, arguments);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 } 2710 }
2699 ReportError(supercall_pos, 2711 ReportError(supercall_pos,
2700 "unresolved implicit call to super constructor '%s()'", 2712 "unresolved implicit call to super constructor '%s()'",
2701 String::Handle(Z, super_class.Name()).ToCString()); 2713 String::Handle(Z, super_class.Name()).ToCString());
2702 } 2714 }
2703 if (current_function().is_const() && !super_ctor.is_const()) { 2715 if (current_function().is_const() && !super_ctor.is_const()) {
2704 ReportError(supercall_pos, "implicit call to non-const super constructor"); 2716 ReportError(supercall_pos, "implicit call to non-const super constructor");
2705 } 2717 }
2706 2718
2707 String& error_message = String::Handle(Z); 2719 String& error_message = String::Handle(Z);
2708 if (!super_ctor.AreValidArguments(arguments->length(), arguments->names(), 2720 if (!super_ctor.AreValidArguments(arguments->type_args_len(),
2721 arguments->length(), arguments->names(),
2709 &error_message)) { 2722 &error_message)) {
2710 ReportError(supercall_pos, 2723 ReportError(supercall_pos,
2711 "invalid arguments passed to super constructor '%s()': %s", 2724 "invalid arguments passed to super constructor '%s()': %s",
2712 String::Handle(Z, super_class.Name()).ToCString(), 2725 String::Handle(Z, super_class.Name()).ToCString(),
2713 error_message.ToCString()); 2726 error_message.ToCString());
2714 } 2727 }
2715 return new StaticCallNode(supercall_pos, super_ctor, arguments); 2728 return new StaticCallNode(supercall_pos, super_ctor, arguments);
2716 } 2729 }
2717 2730
2718 2731
(...skipping 14 matching lines...) Expand all
2733 } 2746 }
2734 CheckToken(Token::kLPAREN, "parameter list expected"); 2747 CheckToken(Token::kLPAREN, "parameter list expected");
2735 2748
2736 ArgumentListNode* arguments = new ArgumentListNode(supercall_pos); 2749 ArgumentListNode* arguments = new ArgumentListNode(supercall_pos);
2737 // 'this' parameter is the first argument to super class constructor. 2750 // 'this' parameter is the first argument to super class constructor.
2738 AstNode* implicit_argument = new LoadLocalNode(supercall_pos, receiver); 2751 AstNode* implicit_argument = new LoadLocalNode(supercall_pos, receiver);
2739 arguments->Add(implicit_argument); 2752 arguments->Add(implicit_argument);
2740 2753
2741 // 'this' parameter must not be accessible to the other super call arguments. 2754 // 'this' parameter must not be accessible to the other super call arguments.
2742 receiver->set_invisible(true); 2755 receiver->set_invisible(true);
2743 ParseActualParameters(arguments, kAllowConst); 2756 ParseActualParameters(arguments, Object::null_type_arguments(), kAllowConst);
2744 receiver->set_invisible(false); 2757 receiver->set_invisible(false);
2745 2758
2746 // Resolve the constructor. 2759 // Resolve the constructor.
2747 const Function& super_ctor = 2760 const Function& super_ctor =
2748 Function::ZoneHandle(Z, super_class.LookupConstructor(ctor_name)); 2761 Function::ZoneHandle(Z, super_class.LookupConstructor(ctor_name));
2749 if (super_ctor.IsNull()) { 2762 if (super_ctor.IsNull()) {
2750 if (super_class.LookupFactory(ctor_name) != Function::null()) { 2763 if (super_class.LookupFactory(ctor_name) != Function::null()) {
2751 ReportError(supercall_pos, 2764 ReportError(supercall_pos,
2752 "super class constructor '%s' " 2765 "super class constructor '%s' "
2753 "must not be a factory constructor", 2766 "must not be a factory constructor",
2754 ctor_name.ToCString()); 2767 ctor_name.ToCString());
2755 } 2768 }
2756 ReportError(supercall_pos, "super class constructor '%s' not found", 2769 ReportError(supercall_pos, "super class constructor '%s' not found",
2757 ctor_name.ToCString()); 2770 ctor_name.ToCString());
2758 } 2771 }
2759 if (current_function().is_const() && !super_ctor.is_const()) { 2772 if (current_function().is_const() && !super_ctor.is_const()) {
2760 ReportError(supercall_pos, "super constructor must be const"); 2773 ReportError(supercall_pos, "super constructor must be const");
2761 } 2774 }
2762 String& error_message = String::Handle(Z); 2775 String& error_message = String::Handle(Z);
2763 if (!super_ctor.AreValidArguments(arguments->length(), arguments->names(), 2776 if (!super_ctor.AreValidArguments(arguments->type_args_len(),
2777 arguments->length(), arguments->names(),
2764 &error_message)) { 2778 &error_message)) {
2765 ReportError(supercall_pos, 2779 ReportError(supercall_pos,
2766 "invalid arguments passed to super class constructor '%s': %s", 2780 "invalid arguments passed to super class constructor '%s': %s",
2767 ctor_name.ToCString(), error_message.ToCString()); 2781 ctor_name.ToCString(), error_message.ToCString());
2768 } 2782 }
2769 return new StaticCallNode(supercall_pos, super_ctor, arguments); 2783 return new StaticCallNode(supercall_pos, super_ctor, arguments);
2770 } 2784 }
2771 2785
2772 2786
2773 AstNode* Parser::ParseInitializer(const Class& cls, 2787 AstNode* Parser::ParseInitializer(const Class& cls,
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
3125 } 3139 }
3126 ctor_name = Symbols::FromConcatAll(T, pieces); 3140 ctor_name = Symbols::FromConcatAll(T, pieces);
3127 CheckToken(Token::kLPAREN, "parameter list expected"); 3141 CheckToken(Token::kLPAREN, "parameter list expected");
3128 3142
3129 ArgumentListNode* arguments = new ArgumentListNode(call_pos); 3143 ArgumentListNode* arguments = new ArgumentListNode(call_pos);
3130 // 'this' parameter is the first argument to constructor. 3144 // 'this' parameter is the first argument to constructor.
3131 AstNode* implicit_argument = new LoadLocalNode(call_pos, receiver); 3145 AstNode* implicit_argument = new LoadLocalNode(call_pos, receiver);
3132 arguments->Add(implicit_argument); 3146 arguments->Add(implicit_argument);
3133 3147
3134 receiver->set_invisible(true); 3148 receiver->set_invisible(true);
3135 ParseActualParameters(arguments, kAllowConst); 3149 ParseActualParameters(arguments, Object::null_type_arguments(), kAllowConst);
3136 receiver->set_invisible(false); 3150 receiver->set_invisible(false);
3137 // Resolve the constructor. 3151 // Resolve the constructor.
3138 const Function& redirect_ctor = 3152 const Function& redirect_ctor =
3139 Function::ZoneHandle(Z, cls.LookupConstructor(ctor_name)); 3153 Function::ZoneHandle(Z, cls.LookupConstructor(ctor_name));
3140 if (redirect_ctor.IsNull()) { 3154 if (redirect_ctor.IsNull()) {
3141 if (cls.LookupFactory(ctor_name) != Function::null()) { 3155 if (cls.LookupFactory(ctor_name) != Function::null()) {
3142 ReportError(call_pos, 3156 ReportError(call_pos,
3143 "redirection constructor '%s' must not be a factory", 3157 "redirection constructor '%s' must not be a factory",
3144 String::Handle(Z, String::ScrubName(ctor_name)).ToCString()); 3158 String::Handle(Z, String::ScrubName(ctor_name)).ToCString());
3145 } 3159 }
3146 ReportError(call_pos, "constructor '%s' not found", 3160 ReportError(call_pos, "constructor '%s' not found",
3147 String::Handle(Z, String::ScrubName(ctor_name)).ToCString()); 3161 String::Handle(Z, String::ScrubName(ctor_name)).ToCString());
3148 } 3162 }
3149 if (current_function().is_const() && !redirect_ctor.is_const()) { 3163 if (current_function().is_const() && !redirect_ctor.is_const()) {
3150 ReportError(call_pos, "redirection constructor '%s' must be const", 3164 ReportError(call_pos, "redirection constructor '%s' must be const",
3151 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString()); 3165 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString());
3152 } 3166 }
3153 String& error_message = String::Handle(Z); 3167 String& error_message = String::Handle(Z);
3154 if (!redirect_ctor.AreValidArguments(arguments->length(), arguments->names(), 3168 if (!redirect_ctor.AreValidArguments(arguments->type_args_len(),
3169 arguments->length(), arguments->names(),
3155 &error_message)) { 3170 &error_message)) {
3156 ReportError(call_pos, "invalid arguments passed to constructor '%s': %s", 3171 ReportError(call_pos, "invalid arguments passed to constructor '%s': %s",
3157 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString(), 3172 String::Handle(Z, redirect_ctor.UserVisibleName()).ToCString(),
3158 error_message.ToCString()); 3173 error_message.ToCString());
3159 } 3174 }
3160 current_block_->statements->Add( 3175 current_block_->statements->Add(
3161 new StaticCallNode(call_pos, redirect_ctor, arguments)); 3176 new StaticCallNode(call_pos, redirect_ctor, arguments));
3162 } 3177 }
3163 3178
3164 3179
(...skipping 6446 matching lines...) Expand 10 before | Expand all | Expand 10 after
9611 return CloseBlock(); 9626 return CloseBlock();
9612 } 9627 }
9613 9628
9614 9629
9615 // Calling VM-internal helpers, uses implementation core library. 9630 // Calling VM-internal helpers, uses implementation core library.
9616 AstNode* Parser::MakeStaticCall(const String& cls_name, 9631 AstNode* Parser::MakeStaticCall(const String& cls_name,
9617 const String& func_name, 9632 const String& func_name,
9618 ArgumentListNode* arguments) { 9633 ArgumentListNode* arguments) {
9619 const Class& cls = Class::Handle(Z, Library::LookupCoreClass(cls_name)); 9634 const Class& cls = Class::Handle(Z, Library::LookupCoreClass(cls_name));
9620 ASSERT(!cls.IsNull()); 9635 ASSERT(!cls.IsNull());
9636 const intptr_t kTypeArgsLen = 0; // Not passing type args to generic func.
9621 const Function& func = Function::ZoneHandle( 9637 const Function& func = Function::ZoneHandle(
9622 Z, Resolver::ResolveStatic(cls, func_name, arguments->length(), 9638 Z, Resolver::ResolveStatic(cls, func_name, kTypeArgsLen,
9623 arguments->names())); 9639 arguments->length(), arguments->names()));
9624 ASSERT(!func.IsNull()); 9640 ASSERT(!func.IsNull());
9625 return new (Z) StaticCallNode(arguments->token_pos(), func, arguments); 9641 return new (Z) StaticCallNode(arguments->token_pos(), func, arguments);
9626 } 9642 }
9627 9643
9628 9644
9629 AstNode* Parser::ParseAssertStatement(bool is_const) { 9645 AstNode* Parser::ParseAssertStatement(bool is_const) {
9630 TRACE_PARSER("ParseAssertStatement"); 9646 TRACE_PARSER("ParseAssertStatement");
9631 ConsumeToken(); // Consume assert keyword. 9647 ConsumeToken(); // Consume assert keyword.
9632 ExpectToken(Token::kLPAREN); 9648 ExpectToken(Token::kLPAREN);
9633 const TokenPosition condition_pos = TokenPos(); 9649 const TokenPosition condition_pos = TokenPos();
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after
11619 expr = let_expr; 11635 expr = let_expr;
11620 } else { 11636 } else {
11621 expr = ParsePostfixExpr(); 11637 expr = ParsePostfixExpr();
11622 } 11638 }
11623 return expr; 11639 return expr;
11624 } 11640 }
11625 11641
11626 11642
11627 ArgumentListNode* Parser::ParseActualParameters( 11643 ArgumentListNode* Parser::ParseActualParameters(
11628 ArgumentListNode* implicit_arguments, 11644 ArgumentListNode* implicit_arguments,
11645 const TypeArguments& func_type_args,
11629 bool require_const) { 11646 bool require_const) {
11630 TRACE_PARSER("ParseActualParameters"); 11647 TRACE_PARSER("ParseActualParameters");
11631 ASSERT(CurrentToken() == Token::kLPAREN); 11648 ASSERT(CurrentToken() == Token::kLPAREN);
11632 const bool saved_mode = SetAllowFunctionLiterals(true); 11649 const bool saved_mode = SetAllowFunctionLiterals(true);
11633 ArgumentListNode* arguments; 11650 ArgumentListNode* arguments;
11634 if (implicit_arguments == NULL) { 11651 if (implicit_arguments == NULL) {
11635 arguments = new (Z) ArgumentListNode(TokenPos()); 11652 // TODO(regis): When require_const is true, do we need to check that
11653 // func_type_args are null or instantiated?
11654 arguments = new (Z) ArgumentListNode(TokenPos(), func_type_args);
11636 } else { 11655 } else {
11656 // If implicit arguments are provided, they include type arguments (if any).
11657 ASSERT(func_type_args.IsNull());
11637 arguments = implicit_arguments; 11658 arguments = implicit_arguments;
11638 } 11659 }
11639 const GrowableObjectArray& names = 11660 const GrowableObjectArray& names =
11640 GrowableObjectArray::Handle(Z, GrowableObjectArray::New(Heap::kOld)); 11661 GrowableObjectArray::Handle(Z, GrowableObjectArray::New(Heap::kOld));
11641 bool named_argument_seen = false; 11662 bool named_argument_seen = false;
11642 if (LookaheadToken(1) != Token::kRPAREN) { 11663 if (LookaheadToken(1) != Token::kRPAREN) {
11643 String& arg_name = String::Handle(Z); 11664 String& arg_name = String::Handle(Z);
11644 do { 11665 do {
11645 ASSERT((CurrentToken() == Token::kLPAREN) || 11666 ASSERT((CurrentToken() == Token::kLPAREN) ||
11646 (CurrentToken() == Token::kCOMMA)); 11667 (CurrentToken() == Token::kCOMMA));
(...skipping 30 matching lines...) Expand all
11677 if (named_argument_seen) { 11698 if (named_argument_seen) {
11678 arguments->set_names(Array::Handle(Z, Array::MakeArray(names))); 11699 arguments->set_names(Array::Handle(Z, Array::MakeArray(names)));
11679 } 11700 }
11680 return arguments; 11701 return arguments;
11681 } 11702 }
11682 11703
11683 11704
11684 AstNode* Parser::ParseStaticCall(const Class& cls, 11705 AstNode* Parser::ParseStaticCall(const Class& cls,
11685 const String& func_name, 11706 const String& func_name,
11686 TokenPosition ident_pos, 11707 TokenPosition ident_pos,
11708 const TypeArguments& func_type_args,
11687 const LibraryPrefix* prefix) { 11709 const LibraryPrefix* prefix) {
11688 TRACE_PARSER("ParseStaticCall"); 11710 TRACE_PARSER("ParseStaticCall");
11689 const TokenPosition call_pos = TokenPos(); 11711 const TokenPosition call_pos = TokenPos();
11690 ASSERT(CurrentToken() == Token::kLPAREN); 11712 ASSERT(CurrentToken() == Token::kLPAREN);
11691 ArgumentListNode* arguments = ParseActualParameters(NULL, kAllowConst); 11713 ArgumentListNode* arguments =
11714 ParseActualParameters(NULL, func_type_args, kAllowConst);
11692 const int num_arguments = arguments->length(); 11715 const int num_arguments = arguments->length();
11693 const Function& func = Function::ZoneHandle( 11716 const Function& func = Function::ZoneHandle(
11694 Z, Resolver::ResolveStatic(cls, func_name, num_arguments, 11717 Z, Resolver::ResolveStatic(cls, func_name, func_type_args.Length(),
11695 arguments->names())); 11718 num_arguments, arguments->names()));
11696 if (func.IsNull()) { 11719 if (func.IsNull()) {
11697 // Check if there is a static field of the same name, it could be a closure 11720 // Check if there is a static field of the same name, it could be a closure
11698 // and so we try and invoke the closure. 11721 // and so we try and invoke the closure.
11699 AstNode* closure = NULL; 11722 AstNode* closure = NULL;
11700 const Field& field = Field::ZoneHandle(Z, cls.LookupStaticField(func_name)); 11723 const Field& field = Field::ZoneHandle(Z, cls.LookupStaticField(func_name));
11701 Function& func = Function::ZoneHandle(Z); 11724 Function& func = Function::ZoneHandle(Z);
11702 if (field.IsNull()) { 11725 if (field.IsNull()) {
11703 // No field, check if we have an explicit getter function. 11726 // No field, check if we have an explicit getter function.
11704 const String& getter_name = 11727 const String& getter_name =
11705 String::ZoneHandle(Z, Field::LookupGetterSymbol(func_name)); 11728 String::ZoneHandle(Z, Field::LookupGetterSymbol(func_name));
11706 if (!getter_name.IsNull()) { 11729 if (!getter_name.IsNull()) {
11730 const int kTypeArgsLen = 0; // no type arguments.
11707 const int kNumArguments = 0; // no arguments. 11731 const int kNumArguments = 0; // no arguments.
11708 func = Resolver::ResolveStatic(cls, getter_name, kNumArguments, 11732 func = Resolver::ResolveStatic(cls, getter_name, kTypeArgsLen,
11709 Object::empty_array()); 11733 kNumArguments, Object::empty_array());
11710 if (!func.IsNull()) { 11734 if (!func.IsNull()) {
11711 ASSERT(func.kind() != RawFunction::kImplicitStaticFinalGetter); 11735 ASSERT(func.kind() != RawFunction::kImplicitStaticFinalGetter);
11712 closure = new (Z) StaticGetterNode( 11736 closure = new (Z) StaticGetterNode(
11713 call_pos, NULL, Class::ZoneHandle(Z, cls.raw()), func_name); 11737 call_pos, NULL, Class::ZoneHandle(Z, cls.raw()), func_name);
11714 return BuildClosureCall(call_pos, closure, arguments); 11738 return BuildClosureCall(call_pos, closure, arguments);
11715 } 11739 }
11716 } 11740 }
11717 } else { 11741 } else {
11718 closure = GenerateStaticFieldLookup(field, call_pos); 11742 closure = GenerateStaticFieldLookup(field, call_pos);
11719 return BuildClosureCall(call_pos, closure, arguments); 11743 return BuildClosureCall(call_pos, closure, arguments);
11720 } 11744 }
11721 // Could not resolve static method: throw a NoSuchMethodError. 11745 // Could not resolve static method: throw a NoSuchMethodError.
11722 return ThrowNoSuchMethodError(ident_pos, cls, func_name, arguments, 11746 return ThrowNoSuchMethodError(ident_pos, cls, func_name, arguments,
11723 InvocationMirror::kStatic, 11747 InvocationMirror::kStatic,
11724 InvocationMirror::kMethod, 11748 InvocationMirror::kMethod,
11725 NULL, // No existing function. 11749 NULL, // No existing function.
11726 prefix); 11750 prefix);
11727 } else if (cls.IsTopLevel() && (cls.library() == Library::CoreLibrary()) && 11751 } else if (cls.IsTopLevel() && (cls.library() == Library::CoreLibrary()) &&
11728 (func.name() == Symbols::Identical().raw())) { 11752 (func.name() == Symbols::Identical().raw()) &&
11753 func_type_args.IsNull()) {
11729 // This is the predefined toplevel function identical(a,b). 11754 // This is the predefined toplevel function identical(a,b).
11730 // Create a comparison node instead of a static call to the function. 11755 // Create a comparison node instead of a static call to the function.
11731 ASSERT(num_arguments == 2); 11756 ASSERT(num_arguments == 2);
11732 11757
11733 // If both arguments are constant expressions of type string, 11758 // If both arguments are constant expressions of type string,
11734 // evaluate and canonicalize them. 11759 // evaluate and canonicalize them.
11735 // This guarantees that identical("ab", "a"+"b") is true. 11760 // This guarantees that identical("ab", "a"+"b") is true.
11736 // An alternative way to guarantee this would be to introduce 11761 // An alternative way to guarantee this would be to introduce
11737 // an AST node that canonicalizes a value. 11762 // an AST node that canonicalizes a value.
11738 AstNode* arg0 = arguments->NodeAt(0); 11763 AstNode* arg0 = arguments->NodeAt(0);
(...skipping 13 matching lines...) Expand all
11752 return new (Z) ComparisonNode(ident_pos, Token::kEQ_STRICT, 11777 return new (Z) ComparisonNode(ident_pos, Token::kEQ_STRICT,
11753 arguments->NodeAt(0), arguments->NodeAt(1)); 11778 arguments->NodeAt(0), arguments->NodeAt(1));
11754 } 11779 }
11755 return new (Z) StaticCallNode(ident_pos, func, arguments); 11780 return new (Z) StaticCallNode(ident_pos, func, arguments);
11756 } 11781 }
11757 11782
11758 11783
11759 AstNode* Parser::ParseInstanceCall(AstNode* receiver, 11784 AstNode* Parser::ParseInstanceCall(AstNode* receiver,
11760 const String& func_name, 11785 const String& func_name,
11761 TokenPosition ident_pos, 11786 TokenPosition ident_pos,
11787 const TypeArguments& func_type_args,
11762 bool is_conditional) { 11788 bool is_conditional) {
11763 TRACE_PARSER("ParseInstanceCall"); 11789 TRACE_PARSER("ParseInstanceCall");
11764 CheckToken(Token::kLPAREN); 11790 CheckToken(Token::kLPAREN);
11765 ArgumentListNode* arguments = ParseActualParameters(NULL, kAllowConst); 11791 ArgumentListNode* arguments =
11792 ParseActualParameters(NULL, func_type_args, kAllowConst);
11766 return new (Z) InstanceCallNode(ident_pos, receiver, func_name, arguments, 11793 return new (Z) InstanceCallNode(ident_pos, receiver, func_name, arguments,
11767 is_conditional); 11794 is_conditional);
11768 } 11795 }
11769 11796
11770 11797
11771 AstNode* Parser::ParseClosureCall(AstNode* closure) { 11798 AstNode* Parser::ParseClosureCall(AstNode* closure,
11799 const TypeArguments& func_type_args) {
11772 TRACE_PARSER("ParseClosureCall"); 11800 TRACE_PARSER("ParseClosureCall");
11773 const TokenPosition call_pos = TokenPos(); 11801 const TokenPosition call_pos = TokenPos();
11774 ASSERT(CurrentToken() == Token::kLPAREN); 11802 ASSERT(CurrentToken() == Token::kLPAREN);
11775 ArgumentListNode* arguments = ParseActualParameters(NULL, kAllowConst); 11803 ArgumentListNode* arguments =
11804 ParseActualParameters(NULL, func_type_args, kAllowConst);
11776 return BuildClosureCall(call_pos, closure, arguments); 11805 return BuildClosureCall(call_pos, closure, arguments);
11777 } 11806 }
11778 11807
11779 11808
11780 AstNode* Parser::GenerateStaticFieldLookup(const Field& field, 11809 AstNode* Parser::GenerateStaticFieldLookup(const Field& field,
11781 TokenPosition ident_pos) { 11810 TokenPosition ident_pos) {
11782 // If the static field has an initializer, initialize the field at compile 11811 // If the static field has an initializer, initialize the field at compile
11783 // time, which is only possible if the field is const. 11812 // time, which is only possible if the field is const.
11784 AstNode* initializing_getter = RunStaticFieldInitializer(field, ident_pos); 11813 AstNode* initializing_getter = RunStaticFieldInitializer(field, ident_pos);
11785 if (initializing_getter != NULL) { 11814 if (initializing_getter != NULL) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
11965 // super calls handled in ParseSuperCall(). 11994 // super calls handled in ParseSuperCall().
11966 ASSERT(!primary_node->IsSuper()); 11995 ASSERT(!primary_node->IsSuper());
11967 left = LoadFieldIfUnresolved(left); 11996 left = LoadFieldIfUnresolved(left);
11968 } 11997 }
11969 } 11998 }
11970 const TokenPosition ident_pos = TokenPos(); 11999 const TokenPosition ident_pos = TokenPos();
11971 String* ident = ExpectIdentifier("identifier expected"); 12000 String* ident = ExpectIdentifier("identifier expected");
11972 if (IsArgumentPart()) { 12001 if (IsArgumentPart()) {
11973 // Identifier followed by optional type arguments and opening paren: 12002 // Identifier followed by optional type arguments and opening paren:
11974 // method call. 12003 // method call.
12004 TypeArguments& func_type_args = TypeArguments::ZoneHandle(Z);
11975 if (CurrentToken() == Token::kLT) { 12005 if (CurrentToken() == Token::kLT) {
11976 // Type arguments. 12006 // Type arguments.
11977 if (!FLAG_generic_method_syntax) { 12007 if (!FLAG_generic_method_syntax) {
11978 ReportError("generic type arguments not supported."); 12008 ReportError("generic type arguments not supported.");
11979 } 12009 }
11980 // TODO(regis): Pass type arguments in generic call. 12010 func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize);
11981 // For now, resolve type arguments and ignore. 12011 if (!FLAG_reify_generic_functions) {
11982 ParseTypeArguments(ClassFinalizer::kCanonicalize); 12012 func_type_args = TypeArguments::null();
12013 }
11983 } 12014 }
11984 PrimaryNode* primary_node = left->AsPrimaryNode(); 12015 PrimaryNode* primary_node = left->AsPrimaryNode();
11985 if ((primary_node != NULL) && primary_node->primary().IsClass()) { 12016 if ((primary_node != NULL) && primary_node->primary().IsClass()) {
11986 // Static method call prefixed with class name. 12017 // Static method call prefixed with class name.
11987 const Class& cls = Class::Cast(primary_node->primary()); 12018 const Class& cls = Class::Cast(primary_node->primary());
11988 selector = 12019 selector = ParseStaticCall(cls, *ident, ident_pos, func_type_args,
11989 ParseStaticCall(cls, *ident, ident_pos, primary_node->prefix()); 12020 primary_node->prefix());
11990 } else { 12021 } else {
11991 if ((primary_node != NULL) && primary_node->is_deferred_reference()) { 12022 if ((primary_node != NULL) && primary_node->is_deferred_reference()) {
11992 const Class& cls = Class::Handle(library_.toplevel_class()); 12023 const Class& cls = Class::Handle(library_.toplevel_class());
11993 selector = 12024 selector = ParseStaticCall(cls, *ident, ident_pos, func_type_args,
11994 ParseStaticCall(cls, *ident, ident_pos, primary_node->prefix()); 12025 primary_node->prefix());
11995 } else { 12026 } else {
11996 selector = 12027 selector = ParseInstanceCall(left, *ident, ident_pos,
11997 ParseInstanceCall(left, *ident, ident_pos, is_conditional); 12028 func_type_args, is_conditional);
11998 } 12029 }
11999 } 12030 }
12000 } else { 12031 } else {
12001 // Field access. 12032 // Field access.
12002 Class& cls = Class::Handle(Z); 12033 Class& cls = Class::Handle(Z);
12003 bool is_deferred = false; 12034 bool is_deferred = false;
12004 if (left->IsPrimaryNode()) { 12035 if (left->IsPrimaryNode()) {
12005 PrimaryNode* primary_node = left->AsPrimaryNode(); 12036 PrimaryNode* primary_node = left->AsPrimaryNode();
12006 is_deferred = primary_node->is_deferred_reference(); 12037 is_deferred = primary_node->is_deferred_reference();
12007 if (primary_node->primary().IsClass()) { 12038 if (primary_node->primary().IsClass()) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
12056 primary_node->is_deferred_reference()); 12087 primary_node->is_deferred_reference());
12057 } else if (primary_node->primary().IsTypeParameter()) { 12088 } else if (primary_node->primary().IsTypeParameter()) {
12058 array = LoadTypeParameter(primary_node); 12089 array = LoadTypeParameter(primary_node);
12059 } else { 12090 } else {
12060 UNREACHABLE(); // Internal parser error. 12091 UNREACHABLE(); // Internal parser error.
12061 } 12092 }
12062 } 12093 }
12063 selector = new (Z) 12094 selector = new (Z)
12064 LoadIndexedNode(bracket_pos, array, index, Class::ZoneHandle(Z)); 12095 LoadIndexedNode(bracket_pos, array, index, Class::ZoneHandle(Z));
12065 } else if (IsArgumentPart()) { 12096 } else if (IsArgumentPart()) {
12097 TypeArguments& func_type_args = TypeArguments::ZoneHandle(Z);
12066 if (CurrentToken() == Token::kLT) { 12098 if (CurrentToken() == Token::kLT) {
12067 // Type arguments. 12099 // Type arguments.
12068 if (!FLAG_generic_method_syntax) { 12100 if (!FLAG_generic_method_syntax) {
12069 ReportError("generic type arguments not supported."); 12101 ReportError("generic type arguments not supported.");
12070 } 12102 }
12071 // TODO(regis): Pass type arguments in generic call. 12103 func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize);
12072 // For now, resolve type arguments and ignore. 12104 if (!FLAG_reify_generic_functions) {
12073 ParseTypeArguments(ClassFinalizer::kCanonicalize); 12105 func_type_args = TypeArguments::null();
12106 }
12074 } 12107 }
12075 if (left->IsPrimaryNode()) { 12108 if (left->IsPrimaryNode()) {
12076 PrimaryNode* primary_node = left->AsPrimaryNode(); 12109 PrimaryNode* primary_node = left->AsPrimaryNode();
12077 const TokenPosition primary_pos = primary_node->token_pos(); 12110 const TokenPosition primary_pos = primary_node->token_pos();
12078 if (primary_node->primary().IsFunction()) { 12111 if (primary_node->primary().IsFunction()) {
12079 const Function& func = Function::Cast(primary_node->primary()); 12112 const Function& func = Function::Cast(primary_node->primary());
12080 const String& func_name = String::ZoneHandle(Z, func.name()); 12113 const String& func_name = String::ZoneHandle(Z, func.name());
12081 if (func.is_static()) { 12114 if (func.is_static()) {
12082 // Parse static function call. 12115 // Parse static function call.
12083 Class& cls = Class::Handle(Z, func.Owner()); 12116 Class& cls = Class::Handle(Z, func.Owner());
12084 selector = ParseStaticCall(cls, func_name, primary_pos); 12117 selector =
12118 ParseStaticCall(cls, func_name, primary_pos, func_type_args);
12085 } else { 12119 } else {
12086 // Dynamic function call on implicit "this" parameter. 12120 // Dynamic function call on implicit "this" parameter.
12087 if (current_function().is_static()) { 12121 if (current_function().is_static()) {
12088 ReportError(primary_pos, 12122 ReportError(primary_pos,
12089 "cannot access instance method '%s' " 12123 "cannot access instance method '%s' "
12090 "from static function", 12124 "from static function",
12091 func_name.ToCString()); 12125 func_name.ToCString());
12092 } 12126 }
12093 selector = 12127 selector = ParseInstanceCall(LoadReceiver(primary_pos), func_name,
12094 ParseInstanceCall(LoadReceiver(primary_pos), func_name, 12128 primary_pos, func_type_args,
12095 primary_pos, false /* is_conditional */); 12129 false /* is_conditional */);
12096 } 12130 }
12097 } else if (primary_node->primary().IsString()) { 12131 } else if (primary_node->primary().IsString()) {
12098 // Primary is an unresolved name. 12132 // Primary is an unresolved name.
12099 if (primary_node->IsSuper()) { 12133 if (primary_node->IsSuper()) {
12100 ReportError(primary_pos, "illegal use of super"); 12134 ReportError(primary_pos, "illegal use of super");
12101 } 12135 }
12102 const String& name = 12136 const String& name =
12103 String::Cast(Object::ZoneHandle(primary_node->primary().raw())); 12137 String::Cast(Object::ZoneHandle(primary_node->primary().raw()));
12104 if (primary_node->is_deferred_reference()) { 12138 if (primary_node->is_deferred_reference()) {
12105 // The static call will be converted to throwing a NSM error. 12139 // The static call will be converted to throwing a NSM error.
12106 const Class& cls = Class::Handle(library_.toplevel_class()); 12140 const Class& cls = Class::Handle(library_.toplevel_class());
12107 selector = 12141 selector = ParseStaticCall(cls, name, primary_pos, func_type_args,
12108 ParseStaticCall(cls, name, primary_pos, primary_node->prefix()); 12142 primary_node->prefix());
12109 } else if (current_function().is_static()) { 12143 } else if (current_function().is_static()) {
12110 // The static call will be converted to throwing a NSM error. 12144 // The static call will be converted to throwing a NSM error.
12111 selector = ParseStaticCall(current_class(), name, primary_pos); 12145 selector = ParseStaticCall(current_class(), name, primary_pos,
12146 func_type_args);
12112 } else { 12147 } else {
12113 // Treat as call to unresolved (instance) method. 12148 // Treat as call to unresolved (instance) method.
12114 selector = 12149 selector =
12115 ParseInstanceCall(LoadReceiver(primary_pos), name, primary_pos, 12150 ParseInstanceCall(LoadReceiver(primary_pos), name, primary_pos,
12116 false /* is_conditional */); 12151 func_type_args, false /* is_conditional */);
12117 } 12152 }
12118 } else if (primary_node->primary().IsTypeParameter()) { 12153 } else if (primary_node->primary().IsTypeParameter()) {
12154 // TODO(regis): What about the parsed type arguments?
12119 selector = LoadTypeParameter(primary_node); 12155 selector = LoadTypeParameter(primary_node);
12120 } else if (primary_node->primary().IsClass()) { 12156 } else if (primary_node->primary().IsClass()) {
12157 // TODO(regis): What about the parsed type arguments?
12121 const Class& type_class = Class::Cast(primary_node->primary()); 12158 const Class& type_class = Class::Cast(primary_node->primary());
12122 AbstractType& type = Type::ZoneHandle( 12159 AbstractType& type = Type::ZoneHandle(
12123 Z, Type::New(type_class, Object::null_type_arguments(), 12160 Z, Type::New(type_class, Object::null_type_arguments(),
12124 primary_pos, Heap::kOld)); 12161 primary_pos, Heap::kOld));
12125 type ^= CanonicalizeType(type); 12162 type ^= CanonicalizeType(type);
12126 // Type may be malbounded, but not malformed. 12163 // Type may be malbounded, but not malformed.
12127 ASSERT(!type.IsMalformed()); 12164 ASSERT(!type.IsMalformed());
12128 selector = new (Z) TypeNode(primary_pos, type, 12165 selector = new (Z) TypeNode(primary_pos, type,
12129 primary_node->is_deferred_reference()); 12166 primary_node->is_deferred_reference());
12130 } else { 12167 } else {
12131 UNREACHABLE(); // Internal parser error. 12168 UNREACHABLE(); // Internal parser error.
12132 } 12169 }
12133 } else { 12170 } else {
12134 // Left is not a primary node; this must be a closure call. 12171 // Left is not a primary node; this must be a closure call.
12135 AstNode* closure = left; 12172 AstNode* closure = left;
12136 selector = ParseClosureCall(closure); 12173 selector = ParseClosureCall(closure, func_type_args);
12137 } 12174 }
12138 } else { 12175 } else {
12139 // No (more) selectors to parse. 12176 // No (more) selectors to parse.
12140 left = LoadFieldIfUnresolved(left); 12177 left = LoadFieldIfUnresolved(left);
12141 if (left->IsPrimaryNode()) { 12178 if (left->IsPrimaryNode()) {
12142 PrimaryNode* primary_node = left->AsPrimaryNode(); 12179 PrimaryNode* primary_node = left->AsPrimaryNode();
12143 const TokenPosition primary_pos = primary->token_pos(); 12180 const TokenPosition primary_pos = primary->token_pos();
12144 if (primary_node->primary().IsFunction()) { 12181 if (primary_node->primary().IsFunction()) {
12145 // Treat as implicit closure. 12182 // Treat as implicit closure.
12146 left = LoadClosure(primary_node); 12183 left = LoadClosure(primary_node);
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
12676 StaticGetterNode(field_ref_pos, NULL, field_owner, field_name); 12713 StaticGetterNode(field_ref_pos, NULL, field_owner, field_name);
12677 } 12714 }
12678 } else if (value.raw() == Object::sentinel().raw()) { 12715 } else if (value.raw() == Object::sentinel().raw()) {
12679 // This field has not been referenced yet and thus the value has 12716 // This field has not been referenced yet and thus the value has
12680 // not been evaluated. If the field is const, call the static getter method 12717 // not been evaluated. If the field is const, call the static getter method
12681 // to evaluate the expression and canonicalize the value. 12718 // to evaluate the expression and canonicalize the value.
12682 if (field.is_const()) { 12719 if (field.is_const()) {
12683 NoReloadScope no_reload_scope(isolate(), thread()); 12720 NoReloadScope no_reload_scope(isolate(), thread());
12684 NoOOBMessageScope no_msg_scope(thread()); 12721 NoOOBMessageScope no_msg_scope(thread());
12685 field.SetStaticValue(Object::transition_sentinel()); 12722 field.SetStaticValue(Object::transition_sentinel());
12686 const int kNumArguments = 0; // no arguments. 12723 const int kTypeArgsLen = 0; // No type argument vector.
12724 const int kNumArguments = 0; // No arguments.
12687 const Function& func = Function::Handle( 12725 const Function& func = Function::Handle(
12688 Z, Resolver::ResolveStatic(field_owner, getter_name, kNumArguments, 12726 Z, Resolver::ResolveStatic(field_owner, getter_name, kTypeArgsLen,
12689 Object::empty_array())); 12727 kNumArguments, Object::empty_array()));
12690 ASSERT(!func.IsNull()); 12728 ASSERT(!func.IsNull());
12691 ASSERT(func.kind() == RawFunction::kImplicitStaticFinalGetter); 12729 ASSERT(func.kind() == RawFunction::kImplicitStaticFinalGetter);
12692 Object& const_value = Object::Handle(Z); 12730 Object& const_value = Object::Handle(Z);
12693 const_value = DartEntry::InvokeFunction(func, Object::empty_array()); 12731 const_value = DartEntry::InvokeFunction(func, Object::empty_array());
12694 if (const_value.IsError()) { 12732 if (const_value.IsError()) {
12695 const Error& error = Error::Cast(const_value); 12733 const Error& error = Error::Cast(const_value);
12696 if (error.IsUnhandledException()) { 12734 if (error.IsUnhandledException()) {
12697 // An exception may not occur in every parse attempt, i.e., the 12735 // An exception may not occur in every parse attempt, i.e., the
12698 // generated AST is not deterministic. Therefore mark the function as 12736 // generated AST is not deterministic. Therefore mark the function as
12699 // not optimizable. 12737 // not optimizable.
(...skipping 30 matching lines...) Expand all
12730 } 12768 }
12731 12769
12732 12770
12733 RawObject* Parser::EvaluateConstConstructorCall( 12771 RawObject* Parser::EvaluateConstConstructorCall(
12734 const Class& type_class, 12772 const Class& type_class,
12735 const TypeArguments& type_arguments, 12773 const TypeArguments& type_arguments,
12736 const Function& constructor, 12774 const Function& constructor,
12737 ArgumentListNode* arguments) { 12775 ArgumentListNode* arguments) {
12738 NoReloadScope no_reload_scope(isolate(), thread()); 12776 NoReloadScope no_reload_scope(isolate(), thread());
12739 NoOOBMessageScope no_msg_scope(thread()); 12777 NoOOBMessageScope no_msg_scope(thread());
12778 // Factories and constructors are not generic functions.
12779 const int kTypeArgsLen = 0;
12740 // Factories have one extra argument: the type arguments. 12780 // Factories have one extra argument: the type arguments.
12741 // Constructors have 1 extra arguments: receiver. 12781 // Constructors have one extra arguments: receiver.
12742 const int kNumExtraArgs = 1; 12782 const int kNumExtraArgs = 1;
12743 const int num_arguments = arguments->length() + kNumExtraArgs; 12783 const int num_arguments = arguments->length() + kNumExtraArgs;
12744 const Array& arg_values = 12784 const Array& arg_values =
12745 Array::Handle(Z, Array::New(num_arguments, Heap::kOld)); 12785 Array::Handle(Z, Array::New(num_arguments, Heap::kOld));
12746 Instance& instance = Instance::Handle(Z); 12786 Instance& instance = Instance::Handle(Z);
12747 if (!constructor.IsFactory()) { 12787 if (!constructor.IsFactory()) {
12748 instance = Instance::New(type_class, Heap::kOld); 12788 instance = Instance::New(type_class, Heap::kOld);
12749 if (!type_arguments.IsNull()) { 12789 if (!type_arguments.IsNull()) {
12750 if (!type_arguments.IsInstantiated()) { 12790 if (!type_arguments.IsInstantiated()) {
12751 ReportError("type must be constant in const constructor"); 12791 ReportError("type must be constant in const constructor");
12752 } 12792 }
12753 instance.SetTypeArguments( 12793 instance.SetTypeArguments(
12754 TypeArguments::Handle(Z, type_arguments.Canonicalize())); 12794 TypeArguments::Handle(Z, type_arguments.Canonicalize()));
12755 } 12795 }
12756 arg_values.SetAt(0, instance); 12796 arg_values.SetAt(0, instance);
12757 } else { 12797 } else {
12758 // Prepend type_arguments to list of arguments to factory. 12798 // Prepend type_arguments to list of arguments to factory.
12759 ASSERT(type_arguments.IsZoneHandle()); 12799 ASSERT(type_arguments.IsZoneHandle());
12760 arg_values.SetAt(0, type_arguments); 12800 arg_values.SetAt(0, type_arguments);
12761 } 12801 }
12762 for (int i = 0; i < arguments->length(); i++) { 12802 for (int i = 0; i < arguments->length(); i++) {
12763 AstNode* arg = arguments->NodeAt(i); 12803 AstNode* arg = arguments->NodeAt(i);
12764 // Arguments have been evaluated to a literal value already. 12804 // Arguments have been evaluated to a literal value already.
12765 ASSERT(arg->IsLiteralNode()); 12805 ASSERT(arg->IsLiteralNode());
12766 arg_values.SetAt((i + kNumExtraArgs), arg->AsLiteralNode()->literal()); 12806 arg_values.SetAt((i + kNumExtraArgs), arg->AsLiteralNode()->literal());
12767 } 12807 }
12768 const Array& args_descriptor = Array::Handle( 12808 const Array& args_descriptor =
12769 Z, ArgumentsDescriptor::New(num_arguments, arguments->names())); 12809 Array::Handle(Z, ArgumentsDescriptor::New(kTypeArgsLen, num_arguments,
12810 arguments->names()));
12770 const Object& result = Object::Handle( 12811 const Object& result = Object::Handle(
12771 Z, DartEntry::InvokeFunction(constructor, arg_values, args_descriptor)); 12812 Z, DartEntry::InvokeFunction(constructor, arg_values, args_descriptor));
12772 if (result.IsError()) { 12813 if (result.IsError()) {
12773 // An exception may not occur in every parse attempt, i.e., the 12814 // An exception may not occur in every parse attempt, i.e., the
12774 // generated AST is not deterministic. Therefore mark the function as 12815 // generated AST is not deterministic. Therefore mark the function as
12775 // not optimizable. 12816 // not optimizable.
12776 current_function().SetIsOptimizable(false); 12817 current_function().SetIsOptimizable(false);
12777 if (result.IsUnhandledException()) { 12818 if (result.IsUnhandledException()) {
12778 return result.raw(); 12819 return result.raw();
12779 } else { 12820 } else {
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
14063 ConsumeToken(); 14104 ConsumeToken();
14064 named_constructor = ExpectIdentifier("name of constructor expected"); 14105 named_constructor = ExpectIdentifier("name of constructor expected");
14065 } 14106 }
14066 14107
14067 // Parse constructor parameters. 14108 // Parse constructor parameters.
14068 TokenPosition call_pos = TokenPos(); 14109 TokenPosition call_pos = TokenPos();
14069 ArgumentListNode* arguments = NULL; 14110 ArgumentListNode* arguments = NULL;
14070 if (!is_tearoff_expression) { 14111 if (!is_tearoff_expression) {
14071 CheckToken(Token::kLPAREN); 14112 CheckToken(Token::kLPAREN);
14072 call_pos = TokenPos(); 14113 call_pos = TokenPos();
14073 arguments = ParseActualParameters(NULL, is_const); 14114 arguments =
14115 ParseActualParameters(NULL, TypeArguments::ZoneHandle(Z), is_const);
14074 } else { 14116 } else {
14075 // Allocate dummy node with no arguments so we don't have to deal 14117 // Allocate dummy node with no arguments so we don't have to deal
14076 // with the NULL corner case below. 14118 // with the NULL corner case below.
14077 arguments = new (Z) ArgumentListNode(TokenPos()); 14119 arguments = new (Z) ArgumentListNode(TokenPos());
14078 } 14120 }
14079 14121
14080 // Parsing is complete, so we can return a throw in case of a malformed or 14122 // Parsing is complete, so we can return a throw in case of a malformed or
14081 // malbounded type or report a compile-time error if the constructor is const. 14123 // malbounded type or report a compile-time error if the constructor is const.
14082 if (type.IsMalformedOrMalbounded()) { 14124 if (type.IsMalformedOrMalbounded()) {
14083 if (is_const) { 14125 if (is_const) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
14242 if (!type_arguments.IsNull() && !type_arguments.IsInstantiated()) { 14284 if (!type_arguments.IsNull() && !type_arguments.IsInstantiated()) {
14243 CaptureAllInstantiators(); 14285 CaptureAllInstantiators();
14244 } 14286 }
14245 SequenceNode* tearoff_body = CloseBlock(); 14287 SequenceNode* tearoff_body = CloseBlock();
14246 ClosureNode* closure_obj = 14288 ClosureNode* closure_obj =
14247 new (Z) ClosureNode(new_pos, tearoff_func, NULL, tearoff_body->scope()); 14289 new (Z) ClosureNode(new_pos, tearoff_func, NULL, tearoff_body->scope());
14248 return closure_obj; 14290 return closure_obj;
14249 } 14291 }
14250 14292
14251 ASSERT(!is_tearoff_expression); 14293 ASSERT(!is_tearoff_expression);
14294 const int kTypeArgsLen = 0;
14252 String& error_message = String::Handle(Z); 14295 String& error_message = String::Handle(Z);
14253 if (!constructor.AreValidArguments(arguments_length, arguments->names(), 14296 if (!constructor.AreValidArguments(kTypeArgsLen, arguments_length,
14254 &error_message)) { 14297 arguments->names(), &error_message)) {
14255 const String& external_constructor_name = 14298 const String& external_constructor_name =
14256 (named_constructor ? constructor_name : type_class_name); 14299 (named_constructor ? constructor_name : type_class_name);
14257 if (is_const) { 14300 if (is_const) {
14258 ReportError(call_pos, 14301 ReportError(call_pos,
14259 "invalid arguments passed to constructor '%s' " 14302 "invalid arguments passed to constructor '%s' "
14260 "for class '%s': %s", 14303 "for class '%s': %s",
14261 external_constructor_name.ToCString(), 14304 external_constructor_name.ToCString(),
14262 String::Handle(Z, type_class.Name()).ToCString(), 14305 String::Handle(Z, type_class.Name()).ToCString(),
14263 error_message.ToCString()); 14306 error_message.ToCString());
14264 } 14307 }
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
14650 if (current_class().SuperClass() == Class::null()) { 14693 if (current_class().SuperClass() == Class::null()) {
14651 ReportError("class '%s' does not have a superclass", 14694 ReportError("class '%s' does not have a superclass",
14652 String::Handle(Z, current_class().Name()).ToCString()); 14695 String::Handle(Z, current_class().Name()).ToCString());
14653 } 14696 }
14654 const TokenPosition super_pos = TokenPos(); 14697 const TokenPosition super_pos = TokenPos();
14655 ConsumeToken(); 14698 ConsumeToken();
14656 if (CurrentToken() == Token::kPERIOD) { 14699 if (CurrentToken() == Token::kPERIOD) {
14657 ConsumeToken(); 14700 ConsumeToken();
14658 const TokenPosition ident_pos = TokenPos(); 14701 const TokenPosition ident_pos = TokenPos();
14659 const String& ident = *ExpectIdentifier("identifier expected"); 14702 const String& ident = *ExpectIdentifier("identifier expected");
14660 if (CurrentToken() == Token::kLPAREN) { 14703 if (IsArgumentPart()) {
14661 primary = ParseSuperCall(ident); 14704 TypeArguments& func_type_args = TypeArguments::ZoneHandle(Z);
14705 if (CurrentToken() == Token::kLT) {
14706 // Type arguments.
14707 if (!FLAG_generic_method_syntax) {
14708 ReportError("generic type arguments not supported.");
14709 }
14710 func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize);
14711 if (!FLAG_reify_generic_functions) {
14712 func_type_args = TypeArguments::null();
14713 }
14714 }
14715 primary = ParseSuperCall(ident, func_type_args);
14662 } else { 14716 } else {
14663 primary = ParseSuperFieldAccess(ident, ident_pos); 14717 primary = ParseSuperFieldAccess(ident, ident_pos);
14664 } 14718 }
14665 } else if ((CurrentToken() == Token::kLBRACK) || 14719 } else if ((CurrentToken() == Token::kLBRACK) ||
14666 Token::CanBeOverloaded(CurrentToken()) || 14720 Token::CanBeOverloaded(CurrentToken()) ||
14667 (CurrentToken() == Token::kNE)) { 14721 (CurrentToken() == Token::kNE)) {
14668 primary = ParseSuperOperator(); 14722 primary = ParseSuperOperator();
14669 } else if (CurrentToken() == Token::kQM_PERIOD) { 14723 } else if (CurrentToken() == Token::kQM_PERIOD) {
14670 ReportError("super call or super getter may not use ?."); 14724 ReportError("super call or super getter may not use ?.");
14671 } else { 14725 } else {
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
15197 const ArgumentListNode& function_args, 15251 const ArgumentListNode& function_args,
15198 const LocalVariable* temp_for_last_arg, 15252 const LocalVariable* temp_for_last_arg,
15199 bool is_super_invocation) { 15253 bool is_super_invocation) {
15200 UNREACHABLE(); 15254 UNREACHABLE();
15201 return NULL; 15255 return NULL;
15202 } 15256 }
15203 15257
15204 } // namespace dart 15258 } // namespace dart
15205 15259
15206 #endif // DART_PRECOMPILED_RUNTIME 15260 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698