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

Side by Side Diff: pkg/analyzer/lib/src/summary/summarize_const_expr.dart

Issue 2662963003: Reset serialized expression to empty on StateError. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library serialization.summarize_const_expr; 5 library serialization.summarize_const_expr;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/element/type.dart' show DartType; 9 import 'package:analyzer/dart/element/type.dart' show DartType;
10 import 'package:analyzer/src/summary/format.dart'; 10 import 'package:analyzer/src/summary/format.dart';
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void serialize(Expression expr) { 120 void serialize(Expression expr) {
121 try { 121 try {
122 if (expr is NamedExpression) { 122 if (expr is NamedExpression) {
123 NamedExpression namedExpression = expr; 123 NamedExpression namedExpression = expr;
124 name = namedExpression.name.label.name; 124 name = namedExpression.name.label.name;
125 expr = namedExpression.expression; 125 expr = namedExpression.expression;
126 } 126 }
127 _serialize(expr); 127 _serialize(expr);
128 } on StateError { 128 } on StateError {
129 isValidConst = false; 129 isValidConst = false;
130 operations.clear();
131 assignmentOperators.clear();
132 ints.clear();
133 doubles.clear();
134 strings.clear();
135 references.clear();
130 } 136 }
131 } 137 }
132 138
133 /** 139 /**
134 * Serialize the given [annotation] into this serializer state. 140 * Serialize the given [annotation] into this serializer state.
135 */ 141 */
136 void serializeAnnotation(Annotation annotation); 142 void serializeAnnotation(Annotation annotation);
137 143
138 /** 144 /**
139 * Return [EntityRefBuilder] that corresponds to the constructor having name 145 * Return [EntityRefBuilder] that corresponds to the constructor having name
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 if (typeArguments == null) { 670 if (typeArguments == null) {
665 ints.add(0); 671 ints.add(0);
666 } else { 672 } else {
667 ints.add(typeArguments.arguments.length); 673 ints.add(typeArguments.arguments.length);
668 for (TypeAnnotation type in typeArguments.arguments) { 674 for (TypeAnnotation type in typeArguments.arguments) {
669 references.add(serializeTypeName(type)); 675 references.add(serializeTypeName(type));
670 } 676 }
671 } 677 }
672 } 678 }
673 } 679 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698