| 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 18 matching lines...) Expand all Loading... |
| 29 final List<double> doubles = <double>[]; | 29 final List<double> doubles = <double>[]; |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * See [UnlinkedConstBuilder.strings]. | 32 * See [UnlinkedConstBuilder.strings]. |
| 33 */ | 33 */ |
| 34 final List<String> strings = <String>[]; | 34 final List<String> strings = <String>[]; |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * See [UnlinkedConstBuilder.references]. | 37 * See [UnlinkedConstBuilder.references]. |
| 38 */ | 38 */ |
| 39 final List<TypeRefBuilder> references = <TypeRefBuilder>[]; | 39 final List<EntityRefBuilder> references = <EntityRefBuilder>[]; |
| 40 | 40 |
| 41 /** | 41 /** |
| 42 * Serialize the given [expr] expression into this serializer state. | 42 * Serialize the given [expr] expression into this serializer state. |
| 43 */ | 43 */ |
| 44 void serialize(Expression expr) { | 44 void serialize(Expression expr) { |
| 45 if (expr is IntegerLiteral) { | 45 if (expr is IntegerLiteral) { |
| 46 _pushInt(expr.value); | 46 _pushInt(expr.value); |
| 47 } else if (expr is DoubleLiteral) { | 47 } else if (expr is DoubleLiteral) { |
| 48 operations.add(UnlinkedConstOperation.pushDouble); | 48 operations.add(UnlinkedConstOperation.pushDouble); |
| 49 doubles.add(expr.value); | 49 doubles.add(expr.value); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 serialize(expr.target); | 96 serialize(expr.target); |
| 97 operations.add(UnlinkedConstOperation.length); | 97 operations.add(UnlinkedConstOperation.length); |
| 98 } else if (expr is ParenthesizedExpression) { | 98 } else if (expr is ParenthesizedExpression) { |
| 99 serialize(expr.expression); | 99 serialize(expr.expression); |
| 100 } else { | 100 } else { |
| 101 throw new _ConstExprSerializationError('Unknown expression type: $expr'); | 101 throw new _ConstExprSerializationError('Unknown expression type: $expr'); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * Return [TypeRefBuilder] that corresponds to the given [identifier]. | 106 * Return [EntityRefBuilder] that corresponds to the given [identifier]. |
| 107 */ | 107 */ |
| 108 TypeRefBuilder serializeIdentifier(Identifier identifier); | 108 EntityRefBuilder serializeIdentifier(Identifier identifier); |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * Return [TypeRefBuilder] that corresponds to the given [type]. | 111 * Return [EntityRefBuilder] that corresponds to the given [type]. |
| 112 */ | 112 */ |
| 113 TypeRefBuilder serializeType(TypeName type); | 113 EntityRefBuilder serializeType(TypeName type); |
| 114 | 114 |
| 115 /** | 115 /** |
| 116 * Return the [UnlinkedConstBuilder] that corresponds to the state of this | 116 * Return the [UnlinkedConstBuilder] that corresponds to the state of this |
| 117 * serializer. | 117 * serializer. |
| 118 */ | 118 */ |
| 119 UnlinkedConstBuilder toBuilder() { | 119 UnlinkedConstBuilder toBuilder() { |
| 120 return new UnlinkedConstBuilder( | 120 return new UnlinkedConstBuilder( |
| 121 operations: operations, | 121 operations: operations, |
| 122 ints: ints, | 122 ints: ints, |
| 123 doubles: doubles, | 123 doubles: doubles, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 * Error that describes a problem during a constant expression serialization. | 290 * Error that describes a problem during a constant expression serialization. |
| 291 */ | 291 */ |
| 292 class _ConstExprSerializationError { | 292 class _ConstExprSerializationError { |
| 293 final String message; | 293 final String message; |
| 294 | 294 |
| 295 _ConstExprSerializationError(this.message); | 295 _ConstExprSerializationError(this.message); |
| 296 | 296 |
| 297 @override | 297 @override |
| 298 String toString() => message; | 298 String toString() => message; |
| 299 } | 299 } |
| OLD | NEW |