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

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

Issue 1854213002: Add support for serializing 'target[index]' expressions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/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/src/summary/format.dart'; 9 import 'package:analyzer/src/summary/format.dart';
10 import 'package:analyzer/src/summary/idl.dart'; 10 import 'package:analyzer/src/summary/idl.dart';
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 _serialize(expr.condition); 234 _serialize(expr.condition);
235 _serialize(expr.thenExpression); 235 _serialize(expr.thenExpression);
236 _serialize(expr.elseExpression); 236 _serialize(expr.elseExpression);
237 operations.add(UnlinkedConstOperation.conditional); 237 operations.add(UnlinkedConstOperation.conditional);
238 } else if (expr is PrefixExpression) { 238 } else if (expr is PrefixExpression) {
239 _serializePrefixExpression(expr); 239 _serializePrefixExpression(expr);
240 } else if (expr is PropertyAccess) { 240 } else if (expr is PropertyAccess) {
241 _serializePropertyAccess(expr); 241 _serializePropertyAccess(expr);
242 } else if (expr is ParenthesizedExpression) { 242 } else if (expr is ParenthesizedExpression) {
243 _serialize(expr.expression); 243 _serialize(expr.expression);
244 } else if (expr is IndexExpression) {
245 _serialize(expr.target);
246 _serialize(expr.index);
247 operations.add(UnlinkedConstOperation.extractIndex);
244 } else { 248 } else {
245 throw new StateError('Unknown expression type: $expr'); 249 throw new StateError('Unknown expression type: $expr');
246 } 250 }
247 } 251 }
248 252
249 void _serializeBinaryExpression(BinaryExpression expr) { 253 void _serializeBinaryExpression(BinaryExpression expr) {
250 _serialize(expr.leftOperand); 254 _serialize(expr.leftOperand);
251 _serialize(expr.rightOperand); 255 _serialize(expr.rightOperand);
252 TokenType operator = expr.operator.type; 256 TokenType operator = expr.operator.type;
253 if (operator == TokenType.EQ_EQ) { 257 if (operator == TokenType.EQ_EQ) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 expr = (expr as PrefixedIdentifier).prefix; 392 expr = (expr as PrefixedIdentifier).prefix;
389 } else if (expr is PropertyAccess) { 393 } else if (expr is PropertyAccess) {
390 expr = (expr as PropertyAccess).target; 394 expr = (expr as PropertyAccess).target;
391 } else { 395 } else {
392 return false; 396 return false;
393 } 397 }
394 } 398 }
395 return false; 399 return false;
396 } 400 }
397 } 401 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698