Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 strings.add(expr.prefix.name); | 279 strings.add(expr.prefix.name); |
| 280 operations.add(UnlinkedExprOperation.pushParameter); | 280 operations.add(UnlinkedExprOperation.pushParameter); |
| 281 strings.add(expr.identifier.name); | 281 strings.add(expr.identifier.name); |
| 282 operations.add(UnlinkedExprOperation.assignToProperty); | 282 operations.add(UnlinkedExprOperation.assignToProperty); |
| 283 } else { | 283 } else { |
| 284 throw new StateError('Unsupported assignable: $expr'); | 284 throw new StateError('Unsupported assignable: $expr'); |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 void _pushInt(int value) { | 288 void _pushInt(int value) { |
| 289 if (value == null) { | |
| 290 value = 0; | |
|
scheglov
2017/05/30 17:25:18
This could be also.
value ??= 0;
Brian Wilkerson
2017/05/30 17:38:45
Done
| |
| 291 } | |
| 289 assert(value >= 0); | 292 assert(value >= 0); |
| 290 if (value >= 0x100000000) { | 293 if (value >= 0x100000000) { |
| 291 int numOfComponents = 0; | 294 int numOfComponents = 0; |
| 292 ints.add(numOfComponents); | 295 ints.add(numOfComponents); |
| 293 void pushComponents(int value) { | 296 void pushComponents(int value) { |
| 294 if (value >= 0x100000000) { | 297 if (value >= 0x100000000) { |
| 295 pushComponents(value ~/ 0x100000000); | 298 pushComponents(value ~/ 0x100000000); |
| 296 } | 299 } |
| 297 numOfComponents++; | 300 numOfComponents++; |
| 298 ints.add(value & 0xFFFFFFFF); | 301 ints.add(value & 0xFFFFFFFF); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 689 if (typeArguments == null) { | 692 if (typeArguments == null) { |
| 690 ints.add(0); | 693 ints.add(0); |
| 691 } else { | 694 } else { |
| 692 ints.add(typeArguments.arguments.length); | 695 ints.add(typeArguments.arguments.length); |
| 693 for (TypeAnnotation type in typeArguments.arguments) { | 696 for (TypeAnnotation type in typeArguments.arguments) { |
| 694 references.add(serializeTypeName(type)); | 697 references.add(serializeTypeName(type)); |
| 695 } | 698 } |
| 696 } | 699 } |
| 697 } | 700 } |
| 698 } | 701 } |
| OLD | NEW |