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 serialization.elements; | 5 library serialization.elements; |
6 | 6 |
7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
8 import 'package:analyzer/dart/element/type.dart'; | 8 import 'package:analyzer/dart/element/type.dart'; |
9 import 'package:analyzer/src/dart/element/type.dart'; | 9 import 'package:analyzer/src/dart/element/type.dart'; |
10 import 'package:analyzer/src/generated/resolver.dart'; | 10 import 'package:analyzer/src/generated/resolver.dart'; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 213 } |
214 | 214 |
215 /** | 215 /** |
216 * Serialize the given [classElement], creating an [UnlinkedClass]. | 216 * Serialize the given [classElement], creating an [UnlinkedClass]. |
217 */ | 217 */ |
218 UnlinkedClassBuilder serializeClass(ClassElement classElement) { | 218 UnlinkedClassBuilder serializeClass(ClassElement classElement) { |
219 UnlinkedClassBuilder b = new UnlinkedClassBuilder(ctx); | 219 UnlinkedClassBuilder b = new UnlinkedClassBuilder(ctx); |
220 b.name = classElement.name; | 220 b.name = classElement.name; |
221 b.typeParameters = | 221 b.typeParameters = |
222 classElement.typeParameters.map(serializeTypeParam).toList(); | 222 classElement.typeParameters.map(serializeTypeParam).toList(); |
223 if (classElement.supertype != null && !classElement.supertype.isObject) { | 223 if (classElement.supertype == null) { |
| 224 b.hasNoSupertype = true; |
| 225 } else if (!classElement.supertype.isObject) { |
224 b.supertype = serializeTypeRef(classElement.supertype, classElement); | 226 b.supertype = serializeTypeRef(classElement.supertype, classElement); |
225 } | 227 } |
226 b.mixins = classElement.mixins | 228 b.mixins = classElement.mixins |
227 .map((InterfaceType t) => serializeTypeRef(t, classElement)) | 229 .map((InterfaceType t) => serializeTypeRef(t, classElement)) |
228 .toList(); | 230 .toList(); |
229 b.interfaces = classElement.interfaces | 231 b.interfaces = classElement.interfaces |
230 .map((InterfaceType t) => serializeTypeRef(t, classElement)) | 232 .map((InterfaceType t) => serializeTypeRef(t, classElement)) |
231 .toList(); | 233 .toList(); |
232 List<UnlinkedVariableBuilder> fields = <UnlinkedVariableBuilder>[]; | 234 List<UnlinkedVariableBuilder> fields = <UnlinkedVariableBuilder>[]; |
233 List<UnlinkedExecutableBuilder> executables = <UnlinkedExecutableBuilder>[]; | 235 List<UnlinkedExecutableBuilder> executables = <UnlinkedExecutableBuilder>[]; |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); | 556 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); |
555 b.name = variable.name; | 557 b.name = variable.name; |
556 b.type = serializeTypeRef(variable.type, variable); | 558 b.type = serializeTypeRef(variable.type, variable); |
557 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; | 559 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; |
558 b.isFinal = variable.isFinal; | 560 b.isFinal = variable.isFinal; |
559 b.isConst = variable.isConst; | 561 b.isConst = variable.isConst; |
560 b.hasImplicitType = variable.hasImplicitType; | 562 b.hasImplicitType = variable.hasImplicitType; |
561 return b; | 563 return b; |
562 } | 564 } |
563 } | 565 } |
OLD | NEW |