| 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/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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } else if (expr is StringLiteral) { | 56 } else if (expr is StringLiteral) { |
| 57 _serializeString(expr); | 57 _serializeString(expr); |
| 58 } else if (expr is SymbolLiteral) { | 58 } else if (expr is SymbolLiteral) { |
| 59 strings.add(expr.components.map((token) => token.lexeme).join('.')); | 59 strings.add(expr.components.map((token) => token.lexeme).join('.')); |
| 60 operations.add(UnlinkedConstOperation.pushString); | 60 operations.add(UnlinkedConstOperation.pushString); |
| 61 operations.add(UnlinkedConstOperation.makeSymbol); | 61 operations.add(UnlinkedConstOperation.makeSymbol); |
| 62 } else if (expr is NullLiteral) { | 62 } else if (expr is NullLiteral) { |
| 63 operations.add(UnlinkedConstOperation.pushNull); | 63 operations.add(UnlinkedConstOperation.pushNull); |
| 64 } else if (expr is Identifier) { | 64 } else if (expr is Identifier) { |
| 65 references.add(serializeIdentifier(expr)); | 65 references.add(serializeIdentifier(expr)); |
| 66 operations.add(UnlinkedConstOperation.pushReference); |
| 66 } else if (expr is InstanceCreationExpression) { | 67 } else if (expr is InstanceCreationExpression) { |
| 67 _serializeInstanceCreation(expr); | 68 _serializeInstanceCreation(expr); |
| 68 } else if (expr is ListLiteral) { | 69 } else if (expr is ListLiteral) { |
| 69 _serializeListLiteral(expr); | 70 _serializeListLiteral(expr); |
| 70 } else if (expr is MapLiteral) { | 71 } else if (expr is MapLiteral) { |
| 71 _serializeMapLiteral(expr); | 72 _serializeMapLiteral(expr); |
| 72 } else if (expr is MethodInvocation) { | 73 } else if (expr is MethodInvocation) { |
| 73 String name = expr.methodName.name; | 74 String name = expr.methodName.name; |
| 74 if (name != 'identical') { | 75 if (name != 'identical') { |
| 75 throw new _ConstExprSerializationError( | 76 throw new _ConstExprSerializationError( |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 * Error that describes a problem during a constant expression serialization. | 273 * Error that describes a problem during a constant expression serialization. |
| 273 */ | 274 */ |
| 274 class _ConstExprSerializationError { | 275 class _ConstExprSerializationError { |
| 275 final String message; | 276 final String message; |
| 276 | 277 |
| 277 _ConstExprSerializationError(this.message); | 278 _ConstExprSerializationError(this.message); |
| 278 | 279 |
| 279 @override | 280 @override |
| 280 String toString() => message; | 281 String toString() => message; |
| 281 } | 282 } |
| OLD | NEW |