OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.serialization.constants; | 5 library dart2js.serialization.constants; |
6 | 6 |
7 import '../constants/constructors.dart'; | 7 import '../constants/constructors.dart'; |
8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
10 import '../elements/elements.dart' show FieldElement; | 10 import '../elements/elements.dart' show FieldElement; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 encoder.setString(Key.VALUE, exp.primitiveValue); | 98 encoder.setString(Key.VALUE, exp.primitiveValue); |
99 } | 99 } |
100 | 100 |
101 @override | 101 @override |
102 void visitNull(NullConstantExpression exp, ObjectEncoder encoder) { | 102 void visitNull(NullConstantExpression exp, ObjectEncoder encoder) { |
103 // No additional data needed. | 103 // No additional data needed. |
104 } | 104 } |
105 | 105 |
106 @override | 106 @override |
107 void visitSymbol(SymbolConstantExpression exp, ObjectEncoder encoder) { | 107 void visitSymbol(SymbolConstantExpression exp, ObjectEncoder encoder) { |
108 throw new UnsupportedError( | 108 encoder.setString(Key.NAME, exp.name); |
109 "ConstantSerializer.visitSymbol: ${exp.getText()}"); | |
110 } | 109 } |
111 | 110 |
112 @override | 111 @override |
113 void visitType(TypeConstantExpression exp, ObjectEncoder encoder) { | 112 void visitType(TypeConstantExpression exp, ObjectEncoder encoder) { |
114 encoder.setType(Key.TYPE, exp.type); | 113 encoder.setType(Key.TYPE, exp.type); |
115 } | 114 } |
116 | 115 |
117 @override | 116 @override |
118 void visitUnary(UnaryConstantExpression exp, ObjectEncoder encoder) { | 117 void visitUnary(UnaryConstantExpression exp, ObjectEncoder encoder) { |
119 encoder.setEnum(Key.OPERATOR, exp.operator.kind); | 118 encoder.setEnum(Key.OPERATOR, exp.operator.kind); |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 readFields(), readConstructorInvocation()); | 388 readFields(), readConstructorInvocation()); |
390 case ConstantConstructorKind.REDIRECTING_GENERATIVE: | 389 case ConstantConstructorKind.REDIRECTING_GENERATIVE: |
391 return new RedirectingGenerativeConstantConstructor( | 390 return new RedirectingGenerativeConstantConstructor( |
392 readDefaults(), readConstructorInvocation()); | 391 readDefaults(), readConstructorInvocation()); |
393 case ConstantConstructorKind.REDIRECTING_FACTORY: | 392 case ConstantConstructorKind.REDIRECTING_FACTORY: |
394 return new RedirectingFactoryConstantConstructor( | 393 return new RedirectingFactoryConstantConstructor( |
395 readConstructorInvocation()); | 394 readConstructorInvocation()); |
396 } | 395 } |
397 } | 396 } |
398 } | 397 } |
OLD | NEW |