| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /// Logic to build unlinked summaries. | 5 /// Logic to build unlinked summaries. |
| 6 library summary.src.summary_builder; | 6 library summary.src.summary_builder; |
| 7 | 7 |
| 8 import 'package:front_end/src/fasta/parser/class_member_parser.dart'; | 8 import 'package:front_end/src/fasta/parser/class_member_parser.dart'; |
| 9 import 'package:front_end/src/fasta/parser/identifier_context.dart'; | 9 import 'package:front_end/src/fasta/parser/identifier_context.dart'; |
| 10 import 'package:front_end/src/fasta/parser/parser.dart'; | 10 import 'package:front_end/src/fasta/parser/parser.dart'; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 void handleNamedArgument(colon) { | 131 void handleNamedArgument(colon) { |
| 132 debugEvent("NamedArg"); | 132 debugEvent("NamedArg"); |
| 133 if (ignore) return; | 133 if (ignore) return; |
| 134 var value = pop(); | 134 var value = pop(); |
| 135 Ref name = pop(); | 135 Ref name = pop(); |
| 136 push(new NamedArg(name.name, value)); | 136 push(new NamedArg(name.name, value)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void handleNewExpression(Token token) { | 139 void endNewExpression(Token token) { |
| 140 debugEvent("NewExpression"); | 140 debugEvent("NewExpression"); |
| 141 if (ignore) return; | 141 if (ignore) return; |
| 142 pop(); // args | 142 pop(); // args |
| 143 pop(); // ctor | 143 pop(); // ctor |
| 144 push(new Invalid(hint: "new")); | 144 push(new Invalid(hint: "new")); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) { | 147 void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) { |
| 148 debugEvent("NoConstructorReferenceContinuationAfterTypeArguments"); | 148 debugEvent("NoConstructorReferenceContinuationAfterTypeArguments"); |
| 149 } | 149 } |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 398 |
| 399 void handleConditionalExpression(Token question, Token colon) { | 399 void handleConditionalExpression(Token question, Token colon) { |
| 400 debugEvent("ConditionalExpression"); | 400 debugEvent("ConditionalExpression"); |
| 401 if (ignore) return; | 401 if (ignore) return; |
| 402 var falseBranch = pop(); | 402 var falseBranch = pop(); |
| 403 var trueBranch = pop(); | 403 var trueBranch = pop(); |
| 404 var cond = pop(); | 404 var cond = pop(); |
| 405 push(new Conditional(cond, trueBranch, falseBranch)); | 405 push(new Conditional(cond, trueBranch, falseBranch)); |
| 406 } | 406 } |
| 407 | 407 |
| 408 void handleConstExpression(Token token) { | 408 @override |
| 409 void endConstExpression(Token token) { |
| 409 debugEvent("ConstExpression"); | 410 debugEvent("ConstExpression"); |
| 410 if (ignore) return; | 411 if (ignore) return; |
| 411 List args = pop(); | 412 List args = pop(); |
| 412 var constructorName = pop(); | 413 var constructorName = pop(); |
| 413 var positional = args.where((a) => a is! NamedArg).toList(); | 414 var positional = args.where((a) => a is! NamedArg).toList(); |
| 414 var named = args.where((a) => a is NamedArg).toList(); | 415 var named = args.where((a) => a is NamedArg).toList(); |
| 415 push(new ConstCreation(constructorName, positional, named)); | 416 push(new ConstCreation(constructorName, positional, named)); |
| 416 } | 417 } |
| 417 | 418 |
| 418 void handleIdentifier(Token token, IdentifierContext context) { | 419 void handleIdentifier(Token token, IdentifierContext context) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 } | 660 } |
| 660 | 661 |
| 661 void handleNamedArgument(colon) { | 662 void handleNamedArgument(colon) { |
| 662 debugEvent("NamedArg"); | 663 debugEvent("NamedArg"); |
| 663 if (ignore) return; | 664 if (ignore) return; |
| 664 pop(); | 665 pop(); |
| 665 pop(); | 666 pop(); |
| 666 push(NullValue.Arguments); | 667 push(NullValue.Arguments); |
| 667 } | 668 } |
| 668 | 669 |
| 669 void handleNewExpression(Token token) { | 670 void endNewExpression(Token token) { |
| 670 debugEvent("NewExpression"); | 671 debugEvent("NewExpression"); |
| 671 if (ignore) return; | 672 if (ignore) return; |
| 672 pop(); // args | 673 pop(); // args |
| 673 /* var ctor = */ pop(); // ctor | 674 /* var ctor = */ pop(); // ctor |
| 674 throw new UnimplementedError(); // TODO(paulberry): fix the code below. | 675 throw new UnimplementedError(); // TODO(paulberry): fix the code below. |
| 675 // push(new Opaque(type: ctor.type, hint: "new")); | 676 // push(new Opaque(type: ctor.type, hint: "new")); |
| 676 } | 677 } |
| 677 | 678 |
| 678 void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) { | 679 void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) { |
| 679 debugEvent("NoConstructorReferenceContinuationAfterTypeArguments"); | 680 debugEvent("NoConstructorReferenceContinuationAfterTypeArguments"); |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 } | 1551 } |
| 1551 | 1552 |
| 1552 /// Internal representation of an initialized name. | 1553 /// Internal representation of an initialized name. |
| 1553 class _InitializedName { | 1554 class _InitializedName { |
| 1554 final String name; | 1555 final String name; |
| 1555 final UnlinkedExecutableBuilder initializer; | 1556 final UnlinkedExecutableBuilder initializer; |
| 1556 _InitializedName(this.name, this.initializer); | 1557 _InitializedName(this.name, this.initializer); |
| 1557 | 1558 |
| 1558 toString() => "II:" + (initializer != null ? "$name = $initializer" : name); | 1559 toString() => "II:" + (initializer != null ? "$name = $initializer" : name); |
| 1559 } | 1560 } |
| OLD | NEW |