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

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

Issue 1651653002: Verify AST instead of constant values. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
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/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/scanner.dart'; 8 import 'package:analyzer/src/generated/scanner.dart';
9 import 'package:analyzer/src/summary/format.dart'; 9 import 'package:analyzer/src/summary/format.dart';
10 10
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 } 162 }
163 163
164 void _serializeBinaryExpression(BinaryExpression expr) { 164 void _serializeBinaryExpression(BinaryExpression expr) {
165 serialize(expr.leftOperand); 165 serialize(expr.leftOperand);
166 serialize(expr.rightOperand); 166 serialize(expr.rightOperand);
167 TokenType operator = expr.operator.type; 167 TokenType operator = expr.operator.type;
168 if (operator == TokenType.EQ_EQ) { 168 if (operator == TokenType.EQ_EQ) {
169 operations.add(UnlinkedConstOperation.equal); 169 operations.add(UnlinkedConstOperation.equal);
170 } else if (operator == TokenType.BANG_EQ) { 170 } else if (operator == TokenType.BANG_EQ) {
171 operations.add(UnlinkedConstOperation.equal); 171 operations.add(UnlinkedConstOperation.notEqual);
172 operations.add(UnlinkedConstOperation.not);
173 } else if (operator == TokenType.AMPERSAND_AMPERSAND) { 172 } else if (operator == TokenType.AMPERSAND_AMPERSAND) {
174 operations.add(UnlinkedConstOperation.and); 173 operations.add(UnlinkedConstOperation.and);
175 } else if (operator == TokenType.BAR_BAR) { 174 } else if (operator == TokenType.BAR_BAR) {
176 operations.add(UnlinkedConstOperation.or); 175 operations.add(UnlinkedConstOperation.or);
177 } else if (operator == TokenType.CARET) { 176 } else if (operator == TokenType.CARET) {
178 operations.add(UnlinkedConstOperation.bitXor); 177 operations.add(UnlinkedConstOperation.bitXor);
179 } else if (operator == TokenType.AMPERSAND) { 178 } else if (operator == TokenType.AMPERSAND) {
180 operations.add(UnlinkedConstOperation.bitAnd); 179 operations.add(UnlinkedConstOperation.bitAnd);
181 } else if (operator == TokenType.BAR) { 180 } else if (operator == TokenType.BAR) {
182 operations.add(UnlinkedConstOperation.bitOr); 181 operations.add(UnlinkedConstOperation.bitOr);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 * Error that describes a problem during a constant expression serialization. 306 * Error that describes a problem during a constant expression serialization.
308 */ 307 */
309 class _ConstExprSerializationError { 308 class _ConstExprSerializationError {
310 final String message; 309 final String message;
311 310
312 _ConstExprSerializationError(this.message); 311 _ConstExprSerializationError(this.message);
313 312
314 @override 313 @override
315 String toString() => message; 314 String toString() => message;
316 } 315 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698