| 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.dart' | 8 import 'package:front_end/src/fasta/parser.dart' |
| 9 show | 9 show |
| 10 ClassMemberParser, | 10 ClassMemberParser, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // push(new Invalid(hint: 'cascades')); | 175 // push(new Invalid(hint: 'cascades')); |
| 176 //} | 176 //} |
| 177 | 177 |
| 178 void _unhandledSend() { | 178 void _unhandledSend() { |
| 179 push(new Invalid(hint: "call")); | 179 push(new Invalid(hint: "call")); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 // bit-masks to encode async modifiers as bits on an int. | 183 // bit-masks to encode async modifiers as bits on an int. |
| 184 | 184 |
| 185 /// Parser listener to build simplified AST expresions. | 185 /// Parser listener to build simplified AST expressions. |
| 186 /// | 186 /// |
| 187 /// The parser produces different trees depending on whether it is used for | 187 /// The parser produces different trees depending on whether it is used for |
| 188 /// constants or initializers, so subclasses specialize the logic accordingly. | 188 /// constants or initializers, so subclasses specialize the logic accordingly. |
| 189 abstract class ExpressionListener extends StackListener { | 189 abstract class ExpressionListener extends StackListener { |
| 190 // Underlying parser that invokes this listener. | 190 // Underlying parser that invokes this listener. |
| 191 static const _invariantCheckToken = "invariant check: starting a function"; | 191 static const _invariantCheckToken = "invariant check: starting a function"; |
| 192 | 192 |
| 193 int _withinFunction = 0; | 193 int _withinFunction = 0; |
| 194 | 194 |
| 195 int _withinCascades = 0; | 195 int _withinCascades = 0; |
| 196 | 196 |
| 197 /// Whether this listener is used to build const expressions. | 197 /// Whether this listener is used to build const expressions. |
| 198 bool get forConst => false; | 198 bool get forConst => false; |
| 199 | 199 |
| 200 /// Whether to ignore the next reduction. Used to ignore nested expresions | 200 /// Whether to ignore the next reduction. Used to ignore nested expressions |
| 201 /// that are either invalid (in constants) or unnecessary (for initializers). | 201 /// that are either invalid (in constants) or unnecessary (for initializers). |
| 202 bool get ignore => _withinFunction > 0 || _withinCascades > 0; | 202 bool get ignore => _withinFunction > 0 || _withinCascades > 0; |
| 203 | 203 |
| 204 Parser get parser; | 204 Parser get parser; |
| 205 | 205 |
| 206 void beginCascade(Token token) { | 206 void beginCascade(Token token) { |
| 207 _withinCascades++; | 207 _withinCascades++; |
| 208 } | 208 } |
| 209 | 209 |
| 210 void beginFunctionDeclaration(token) { | 210 void beginFunctionDeclaration(token) { |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 } | 1560 } |
| 1561 | 1561 |
| 1562 /// Internal representation of an initialized name. | 1562 /// Internal representation of an initialized name. |
| 1563 class _InitializedName { | 1563 class _InitializedName { |
| 1564 final String name; | 1564 final String name; |
| 1565 final UnlinkedExecutableBuilder initializer; | 1565 final UnlinkedExecutableBuilder initializer; |
| 1566 _InitializedName(this.name, this.initializer); | 1566 _InitializedName(this.name, this.initializer); |
| 1567 | 1567 |
| 1568 toString() => "II:" + (initializer != null ? "$name = $initializer" : name); | 1568 toString() => "II:" + (initializer != null ? "$name = $initializer" : name); |
| 1569 } | 1569 } |
| OLD | NEW |