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 dart2js.serialization_system; | 5 library dart2js.serialization_system; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import '../commandline_options.dart'; | 8 import '../commandline_options.dart'; |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/backend_api.dart'; | 10 import '../common/backend_api.dart'; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 class ResolvedAstSerializerPlugin extends SerializerPlugin { | 210 class ResolvedAstSerializerPlugin extends SerializerPlugin { |
211 final Resolution resolution; | 211 final Resolution resolution; |
212 final SerializerPlugin nativeDataSerializer; | 212 final SerializerPlugin nativeDataSerializer; |
213 | 213 |
214 ResolvedAstSerializerPlugin(this.resolution, this.nativeDataSerializer); | 214 ResolvedAstSerializerPlugin(this.resolution, this.nativeDataSerializer); |
215 | 215 |
216 @override | 216 @override |
217 void onElement(Element element, ObjectEncoder createEncoder(String tag)) { | 217 void onElement(Element element, ObjectEncoder createEncoder(String tag)) { |
218 assert(invariant(element, element.isDeclaration, | 218 assert(invariant(element, element.isDeclaration, |
219 message: "Element $element must be the declaration")); | 219 message: "Element $element must be the declaration")); |
| 220 if (element.isError) return; |
220 if (element is MemberElement) { | 221 if (element is MemberElement) { |
221 assert(invariant(element, resolution.hasResolvedAst(element), | 222 assert(invariant(element, resolution.hasResolvedAst(element), |
222 message: "Element $element must have a resolved ast")); | 223 message: "Element $element must have a resolved ast")); |
223 ResolvedAst resolvedAst = resolution.getResolvedAst(element); | 224 ResolvedAst resolvedAst = resolution.getResolvedAst(element); |
224 ObjectEncoder objectEncoder = createEncoder(RESOLVED_AST_TAG); | 225 ObjectEncoder objectEncoder = createEncoder(RESOLVED_AST_TAG); |
225 new ResolvedAstSerializer( | 226 new ResolvedAstSerializer( |
226 objectEncoder, resolvedAst, nativeDataSerializer) | 227 objectEncoder, resolvedAst, nativeDataSerializer) |
227 .serialize(); | 228 .serialize(); |
228 } | 229 } |
229 } | 230 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 278 } |
278 | 279 |
279 @override | 280 @override |
280 void onElement(Element element, ObjectDecoder getDecoder(String tag)) { | 281 void onElement(Element element, ObjectDecoder getDecoder(String tag)) { |
281 ObjectDecoder decoder = getDecoder(RESOLVED_AST_TAG); | 282 ObjectDecoder decoder = getDecoder(RESOLVED_AST_TAG); |
282 if (decoder != null) { | 283 if (decoder != null) { |
283 _decoderMap[element] = decoder; | 284 _decoderMap[element] = decoder; |
284 } | 285 } |
285 } | 286 } |
286 } | 287 } |
OLD | NEW |