| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return listener.topScope.unit; | 91 return listener.topScope.unit; |
| 92 } | 92 } |
| 93 | 93 |
| 94 /// Builder for constant expressions. | 94 /// Builder for constant expressions. |
| 95 /// | 95 /// |
| 96 /// Any invalid subexpression is denoted with [Invalid]. | 96 /// Any invalid subexpression is denoted with [Invalid]. |
| 97 class ConstExpressionBuilder extends ExpressionListener { | 97 class ConstExpressionBuilder extends ExpressionListener { |
| 98 final Uri uri; | 98 final Uri uri; |
| 99 Parser parser; | 99 Parser parser; |
| 100 ConstExpressionBuilder(this.uri) { | 100 ConstExpressionBuilder(this.uri) { |
| 101 parser = new Parser(this, asyncAwaitKeywordsEnabled: true); | 101 parser = new Parser(this); |
| 102 } | 102 } |
| 103 bool get forConst => true; | 103 bool get forConst => true; |
| 104 | 104 |
| 105 void endArguments(int count, Token begin, Token end) { | 105 void endArguments(int count, Token begin, Token end) { |
| 106 debugEvent("Arguments"); | 106 debugEvent("Arguments"); |
| 107 if (ignore) return; | 107 if (ignore) return; |
| 108 push(popList(count) ?? const []); | 108 push(popList(count) ?? const []); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void handleAsOperator(Token op, Token next) { | 111 void handleAsOperator(Token op, Token next) { |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 603 |
| 604 /// Builder for initializer expressions. These expressions exclude any nested | 604 /// Builder for initializer expressions. These expressions exclude any nested |
| 605 /// expression that is not needed to infer strong mode types. | 605 /// expression that is not needed to infer strong mode types. |
| 606 class InitializerBuilder extends ExpressionListener { | 606 class InitializerBuilder extends ExpressionListener { |
| 607 final Uri uri; | 607 final Uri uri; |
| 608 Parser parser; | 608 Parser parser; |
| 609 | 609 |
| 610 int _inArguments = 0; | 610 int _inArguments = 0; |
| 611 | 611 |
| 612 InitializerBuilder(this.uri) { | 612 InitializerBuilder(this.uri) { |
| 613 parser = new Parser(this, asyncAwaitKeywordsEnabled: true); | 613 parser = new Parser(this); |
| 614 } | 614 } |
| 615 | 615 |
| 616 bool get ignore => super.ignore || _inArguments > 0; | 616 bool get ignore => super.ignore || _inArguments > 0; |
| 617 | 617 |
| 618 void beginArguments(Token token) { | 618 void beginArguments(Token token) { |
| 619 // TODO(sigmund): determine if we can ignore arguments. | 619 // TODO(sigmund): determine if we can ignore arguments. |
| 620 //_inArguments++; | 620 //_inArguments++; |
| 621 } | 621 } |
| 622 | 622 |
| 623 // Not necessary, but we don't use the value, so we can abstract it: | 623 // Not necessary, but we don't use the value, so we can abstract it: |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 } | 1590 } |
| 1591 | 1591 |
| 1592 /// Internal representation of an initialized name. | 1592 /// Internal representation of an initialized name. |
| 1593 class _InitializedName { | 1593 class _InitializedName { |
| 1594 final String name; | 1594 final String name; |
| 1595 final UnlinkedExecutableBuilder initializer; | 1595 final UnlinkedExecutableBuilder initializer; |
| 1596 _InitializedName(this.name, this.initializer); | 1596 _InitializedName(this.name, this.initializer); |
| 1597 | 1597 |
| 1598 toString() => "II:" + (initializer != null ? "$name = $initializer" : name); | 1598 toString() => "II:" + (initializer != null ? "$name = $initializer" : name); |
| 1599 } | 1599 } |
| OLD | NEW |