OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 part of analyzer2dart.element_converter; | |
6 | |
7 | |
8 /// Base [dart2js.Element] implementation for converted analyzer elements. | |
9 class ElementY extends dart2js.Element { | |
10 final ElementConverter converter; | |
11 final analyzer.Element element; | |
12 | |
13 @override | |
14 String get name => element.name; | |
15 | |
16 ElementY(this.converter, this.element); | |
17 | |
18 @override | |
19 dart2js.LibraryElement get implementationLibrary => library; | |
20 | |
21 @override | |
22 dart2js.Element get origin => this; | |
23 | |
24 @override | |
25 dart2js.Element get patch => null; | |
26 | |
27 @override | |
28 dart2js.Element get declaration => this; | |
29 | |
30 @override | |
31 dart2js.Element get implementation => this; | |
32 | |
33 @override | |
34 bool get isPatch => false; | |
35 | |
36 @override | |
37 bool get isPatched => false; | |
38 | |
39 @override | |
40 bool get isDeclaration => true; | |
41 | |
42 @override | |
43 bool get isImplementation => false; | |
44 | |
45 @override | |
46 dart2js.LibraryElement get library { | |
47 return converter.convertElement(element.library); | |
48 } | |
49 | |
50 @override | |
51 bool get isLocal => false; | |
52 | |
53 @override | |
54 bool get isSynthesized => false; | |
55 | |
56 unsupported(String method) { | |
57 throw new UnsupportedError( | |
58 "'$method' is unsupported on $this ($runtimeType)"); | |
59 } | |
60 | |
61 | |
62 @override | |
63 bool get isFinal => unsupported('isFinal'); | |
64 | |
65 @override | |
66 bool get isStatic => unsupported('isStatic'); | |
67 | |
68 @override | |
69 bool isForeign(_) => unsupported('isForeign'); | |
70 | |
71 @override | |
72 bool get impliesType => unsupported('impliesType'); | |
73 | |
74 @override | |
75 bool get isOperator => unsupported('impliesType'); | |
76 | |
77 @override | |
78 get position => unsupported('position'); | |
79 | |
80 @override | |
81 computeType(_) => unsupported('computeType'); | |
82 | |
83 @override | |
84 get enclosingElement => unsupported('enclosingElement'); | |
85 | |
86 @override | |
87 accept(_, __) => unsupported('accept'); | |
88 | |
89 @override | |
90 void addMetadata(_) => unsupported('addMetadata'); | |
91 | |
92 @override | |
93 get analyzableElement => unsupported('analyzableElement'); | |
94 | |
95 @override | |
96 asFunctionElement() => unsupported('asFunctionElement'); | |
97 | |
98 @override | |
99 buildScope() => unsupported('buildScope'); | |
100 | |
101 @override | |
102 get compilationUnit => unsupported('compilationUnit'); | |
103 | |
104 @override | |
105 get contextClass => unsupported('contextClass'); | |
106 | |
107 @override | |
108 void diagnose(context, listener) => unsupported('diagnose'); | |
109 | |
110 @override | |
111 get enclosingClass => unsupported('enclosingClass'); | |
112 | |
113 @override | |
114 get enclosingClassOrCompilationUnit { | |
115 return unsupported('enclosingClassOrCompilationUnit'); | |
116 } | |
117 | |
118 @override | |
119 String get fixedBackendName => unsupported('fixedBackendName'); | |
120 | |
121 @override | |
122 bool get hasFixedBackendName => unsupported('hasFixedBackendName'); | |
123 | |
124 @override | |
125 bool get isAbstract => unsupported('isAbstract'); | |
126 | |
127 @override | |
128 bool get isAssignable => unsupported('isAssignable'); | |
129 | |
130 @override | |
131 bool get isClassMember => unsupported('isClassMember'); | |
132 | |
133 @override | |
134 bool get isClosure => unsupported('isClosure'); | |
135 | |
136 @override | |
137 bool get isConst => unsupported('isConst'); | |
138 | |
139 @override | |
140 bool get isDeferredLoaderGetter => unsupported('isDeferredLoaderGetter'); | |
141 | |
142 @override | |
143 bool get isFactoryConstructor => unsupported('isFactoryConstructor'); | |
144 | |
145 @override | |
146 bool get isInjected => unsupported('isInjected'); | |
147 | |
148 @override | |
149 bool get isInstanceMember => unsupported('isInstanceMember'); | |
150 | |
151 @override | |
152 bool get isMixinApplication => unsupported('isMixinApplication'); | |
153 | |
154 @override | |
155 bool get isNative => unsupported('isNative'); | |
156 | |
157 @override | |
158 bool get isTopLevel => unsupported('isTopLevel'); | |
159 | |
160 @override | |
161 get kind => unsupported('kind'); | |
162 | |
163 @override | |
164 get metadata => unsupported('metadata'); | |
165 | |
166 @override | |
167 get outermostEnclosingMemberOrTopLevel { | |
168 return unsupported('outermostEnclosingMemberOrTopLevel'); | |
169 } | |
170 | |
171 @override | |
172 void setNative(String name) => unsupported('setNative'); | |
173 | |
174 String toString() => '$kind($name)'; | |
175 } | |
176 | |
177 abstract class AnalyzableElementY | |
178 implements ElementY, dart2js.AnalyzableElement { | |
179 @override | |
180 bool get hasTreeElements => unsupported('hasTreeElements'); | |
181 | |
182 @override | |
183 get treeElements => unsupported('treeElements'); | |
184 } | |
185 | |
186 abstract class AstElementY implements ElementY, dart2js.AstElement { | |
187 @override | |
188 bool get hasNode => unsupported('hasNode'); | |
189 | |
190 @override | |
191 get node => unsupported('node'); | |
192 | |
193 @override | |
194 bool get hasResolvedAst => unsupported('hasResolvedAst'); | |
195 | |
196 @override | |
197 get resolvedAst => unsupported('resolvedAst'); | |
198 } | |
199 | |
200 class LibraryElementY extends ElementY with AnalyzableElementY | |
201 implements dart2js.LibraryElement { | |
202 analyzer.LibraryElement get element => super.element; | |
203 | |
204 @override | |
205 dart2js.ElementKind get kind => dart2js.ElementKind.LIBRARY; | |
206 | |
207 // TODO(johnniwinther): Ensure the correct semantics of this. | |
208 @override | |
209 bool get isInternalLibrary => isPlatformLibrary && element.isPrivate; | |
210 | |
211 // TODO(johnniwinther): Ensure the correct semantics of this. | |
212 @override | |
213 bool get isPlatformLibrary => element.isInSdk; | |
214 | |
215 @override | |
216 bool get isDartCore => element.isDartCore; | |
217 | |
218 LibraryElementY(ElementConverter converter, analyzer.LibraryElement element) | |
219 : super(converter, element); | |
220 | |
221 @override | |
222 void addCompilationUnit(_) => unsupported('addCompilationUnit'); | |
223 | |
224 @override | |
225 void addImport(element, import, listener) => unsupported('addImport'); | |
226 | |
227 @override | |
228 void addMember(element, listener) => unsupported('addMember'); | |
229 | |
230 @override | |
231 void addTag(tag, listener) => unsupported('addTag'); | |
232 | |
233 @override | |
234 void addToScope(element, listener) => unsupported('addToScope'); | |
235 | |
236 @override | |
237 bool get canUseNative => unsupported('canUseNative'); | |
238 | |
239 @override | |
240 Uri get canonicalUri => unsupported('canonicalUri'); | |
241 | |
242 @override | |
243 int compareTo(other) => unsupported('compareTo'); | |
244 | |
245 @override | |
246 get compilationUnits => unsupported('compilationUnits'); | |
247 | |
248 @override | |
249 get entryCompilationUnit => unsupported('entryCompilationUnit'); | |
250 | |
251 @override | |
252 get exports => unsupported('exports'); | |
253 | |
254 @override | |
255 bool get exportsHandled => unsupported('exportsHandled'); | |
256 | |
257 @override | |
258 find(String elementName) => unsupported('find'); | |
259 | |
260 @override | |
261 findExported(String elementName) => unsupported('findExported'); | |
262 | |
263 @override | |
264 findLocal(String elementName) => unsupported('findLocal'); | |
265 | |
266 @override | |
267 void forEachExport(_) => unsupported('forEachExport'); | |
268 | |
269 @override | |
270 void forEachLocalMember(_) => unsupported('forEachLocalMember'); | |
271 | |
272 @override | |
273 getImportsFor(element) => unsupported('getImportsFor'); | |
274 | |
275 @override | |
276 getLibraryFromTag(tag) => unsupported('getLibraryFromTag'); | |
277 | |
278 @override | |
279 String getLibraryName() => unsupported('getLibraryName'); | |
280 | |
281 @override | |
282 String getLibraryOrScriptName() => unsupported('getLibraryOrScriptName'); | |
283 | |
284 @override | |
285 getNonPrivateElementsInScope() => unsupported('getNonPrivateElementsInScope'); | |
286 | |
287 @override | |
288 bool hasLibraryName() => unsupported('hasLibraryName'); | |
289 | |
290 @override | |
291 bool get isPackageLibrary => unsupported('isPackageLibrary'); | |
292 | |
293 @override | |
294 get libraryTag => unsupported('libraryTag'); | |
295 | |
296 @override | |
297 void set libraryTag(value) => unsupported('libraryTag'); | |
298 | |
299 @override | |
300 localLookup(elementName) => unsupported('localLookup'); | |
301 | |
302 @override | |
303 void recordResolvedTag(tag, library) => unsupported('recordResolvedTag'); | |
304 | |
305 @override | |
306 void setExports(exportedElements) => unsupported('setExports'); | |
307 | |
308 @override | |
309 get tags => unsupported('tags'); | |
310 } | |
311 | |
312 abstract class TopLevelElementMixin implements ElementY { | |
313 @override | |
314 bool get isClassMember => false; | |
315 | |
316 @override | |
317 bool get isInstanceMember => false; | |
318 | |
319 @override | |
320 bool get isTopLevel => true; | |
321 | |
322 // TODO(johnniwinther): Ensure the correct semantics of this. | |
323 @override | |
324 bool get isFactoryConstructor => false; | |
325 | |
326 @override | |
327 bool get isStatic { | |
328 // Semantic difference: Analyzer considers top-level and static class | |
329 // members to be static, dart2js only considers static class members to be | |
330 // static. | |
331 return false; | |
332 } | |
333 | |
334 // TODO(johnniwinther): Ensure the correct semantics of this. | |
335 @override | |
336 bool get isAbstract => false; | |
337 | |
338 @override | |
339 dart2js.ClassElement get enclosingClass => null; | |
340 } | |
341 | |
342 abstract class FunctionElementMixin | |
343 implements ElementY, dart2js.FunctionElement { | |
344 analyzer.ExecutableElement get element; | |
345 | |
346 // TODO(johnniwinther): Ensure the correct semantics of this. | |
347 @override | |
348 bool get isExternal => false; | |
349 | |
350 @override | |
351 bool get isConst => false; | |
352 | |
353 @override | |
354 get abstractField => unsupported('abstractField'); | |
355 | |
356 @override | |
357 computeSignature(_) => unsupported('computeSignature'); | |
358 | |
359 @override | |
360 get memberContext => unsupported('memberContext'); | |
361 | |
362 @override | |
363 get functionSignature => unsupported('functionSignature'); | |
364 | |
365 @override | |
366 bool get hasFunctionSignature => unsupported('hasFunctionSignature'); | |
367 | |
368 @override | |
369 get asyncMarker => unsupported('asyncMarker'); | |
370 | |
371 @override | |
372 List<dart2js.ParameterElement> get parameters { | |
373 return element.parameters.map(converter.convertElement).toList(); | |
374 } | |
375 | |
376 @override | |
377 dart2js.FunctionType get type => converter.convertType(element.type); | |
378 } | |
379 | |
380 class TopLevelFunctionElementY extends ElementY | |
381 with AnalyzableElementY, | |
382 AstElementY, | |
383 TopLevelElementMixin, | |
384 FunctionElementMixin, | |
385 MemberElementMixin | |
386 implements dart2js.MethodElement { | |
387 analyzer.FunctionElement get element => super.element; | |
388 | |
389 @override | |
390 dart2js.ElementKind get kind => dart2js.ElementKind.FUNCTION; | |
391 | |
392 TopLevelFunctionElementY(ElementConverter converter, | |
393 analyzer.FunctionElement element) | |
394 : super(converter, element); | |
395 | |
396 @override | |
397 get nestedClosures => unsupported('nestedClosures'); | |
398 } | |
399 | |
400 class LocalFunctionElementY extends ElementY | |
401 with AnalyzableElementY, | |
402 AstElementY, | |
403 LocalElementMixin, | |
404 FunctionElementMixin | |
405 implements dart2js.LocalFunctionElement { | |
406 analyzer.FunctionElement get element => super.element; | |
407 | |
408 @override | |
409 dart2js.ElementKind get kind => dart2js.ElementKind.FUNCTION; | |
410 | |
411 @override | |
412 bool get isAbstract => false; | |
413 | |
414 @override | |
415 bool get isConst => false; | |
416 | |
417 LocalFunctionElementY(ElementConverter converter, | |
418 analyzer.FunctionElement element) | |
419 : super(converter, element); | |
420 } | |
421 | |
422 class ParameterElementY extends ElementY | |
423 with AnalyzableElementY, AstElementY, VariableElementMixin | |
424 implements dart2js.ParameterElement { | |
425 | |
426 analyzer.ParameterElement get element => super.element; | |
427 | |
428 @override | |
429 dart2js.ElementKind get kind => dart2js.ElementKind.PARAMETER; | |
430 | |
431 @override | |
432 dart2js.DartType get type => converter.convertType(element.type); | |
433 | |
434 @override | |
435 bool get isLocal => true; | |
436 | |
437 @override | |
438 bool get isStatic => false; | |
439 | |
440 @override | |
441 bool get isConst => false; | |
442 | |
443 @override | |
444 bool get isNamed => element.parameterKind == ParameterKind.NAMED; | |
445 | |
446 @override | |
447 bool get isOptional => element.parameterKind.isOptional; | |
448 | |
449 ParameterElementY(ElementConverter converter, | |
450 analyzer.ParameterElement element) | |
451 : super(converter, element) { | |
452 assert(!element.isInitializingFormal); | |
453 } | |
454 | |
455 @override | |
456 get executableContext => unsupported('executableContext'); | |
457 | |
458 @override | |
459 get functionDeclaration => unsupported('functionDeclaration'); | |
460 | |
461 @override | |
462 get functionSignature => unsupported('functionSignature'); | |
463 } | |
464 | |
465 class TypeDeclarationElementY extends ElementY | |
466 with AnalyzableElementY, AstElementY | |
467 implements dart2js.TypeDeclarationElement { | |
468 | |
469 TypeDeclarationElementY(ElementConverter converter, | |
470 analyzer.Element element) | |
471 : super(converter, element); | |
472 | |
473 @override | |
474 void ensureResolved(compiler) => unsupported('ensureResolved'); | |
475 | |
476 @override | |
477 bool get isResolved => unsupported('isResolved'); | |
478 | |
479 @override | |
480 get rawType => null;//unsupported('rawType'); | |
481 | |
482 @override | |
483 int get resolutionState => unsupported('resolutionState'); | |
484 | |
485 @override | |
486 get thisType => unsupported('thisType'); | |
487 | |
488 @override | |
489 get typeVariables => unsupported('typeVariables'); | |
490 } | |
491 | |
492 class ClassElementY extends TypeDeclarationElementY | |
493 implements dart2js.ClassElement { | |
494 | |
495 analyzer.ClassElement get element => super.element; | |
496 | |
497 dart2js.ElementKind get kind => dart2js.ElementKind.CLASS; | |
498 | |
499 @override | |
500 bool get isObject => element.type.isObject; | |
501 | |
502 // TODO(johnniwinther): Ensure the correct semantics. | |
503 // TODO(paulberry,brianwilkerson): [ClassElement.isTypedef] should probably | |
504 // be renamed to [ClassElement.isNamedMixinApplication]. | |
505 @override | |
506 bool get isMixinApplication => element.isTypedef; | |
507 | |
508 @override | |
509 bool get isUnnamedMixinApplication => false; | |
510 | |
511 @override | |
512 bool get isEnumClass => element.isEnum; | |
513 | |
514 @override | |
515 bool get isAbstract => element.isAbstract; | |
516 | |
517 // TODO(johnniwinther): Semantic difference: Dart2js points to unnamed | |
518 // mixin applications, analyzer points to the type in the extends clause or | |
519 // Object if omitted. | |
520 @override | |
521 dart2js.DartType get supertype { | |
522 return element.supertype != null | |
523 ? converter.convertType(element.supertype) | |
524 : null; | |
525 } | |
526 | |
527 @override | |
528 util.Link<dart2js.DartType> get interfaces { | |
529 // TODO(johnniwinther): Support interfaces. | |
530 return const util.Link<dart2js.DartType>(); | |
531 } | |
532 | |
533 // TODO(johnniwinther): Support generic classes. | |
534 @override | |
535 List<dart2js.DartType> get typeVariables => const []; | |
536 | |
537 @override | |
538 bool get isStatic => false; | |
539 | |
540 @override | |
541 bool get isTopLevel => true; | |
542 | |
543 @override | |
544 dart2js.ClassElement get enclosingClass => this; | |
545 | |
546 ClassElementY(ElementConverter converter, analyzer.ClassElement element) | |
547 : super(converter, element); | |
548 | |
549 @override | |
550 void addBackendMember(element) => unsupported('addBackendMember'); | |
551 | |
552 @override | |
553 void addMember(element, listener) => unsupported('addMember'); | |
554 | |
555 @override | |
556 void addToScope(element, listener) => unsupported('addToScope'); | |
557 | |
558 @override | |
559 get allSupertypes => unsupported('allSupertypes'); | |
560 | |
561 @override | |
562 get allSupertypesAndSelf => unsupported('allSupertypesAndSelf'); | |
563 | |
564 @override | |
565 asInstanceOf(cls) => unsupported('asInstanceOf'); | |
566 | |
567 @override | |
568 get callType => unsupported('callType'); | |
569 | |
570 @override | |
571 computeTypeParameters(compiler) => unsupported('computeTypeParameters'); | |
572 | |
573 @override | |
574 get constructors => unsupported('constructors'); | |
575 | |
576 @override | |
577 void forEachBackendMember(f) => unsupported('forEachBackendMember'); | |
578 | |
579 @override | |
580 void forEachClassMember(f) => unsupported('forEachClassMember'); | |
581 | |
582 @override | |
583 void forEachInstanceField(f, {includeSuperAndInjectedMembers: false}) { | |
584 unsupported('forEachInstanceField'); | |
585 } | |
586 | |
587 @override | |
588 void forEachInterfaceMember(f) => unsupported('forEachInterfaceMember'); | |
589 | |
590 @override | |
591 void forEachLocalMember(f) => unsupported('forEachLocalMember'); | |
592 | |
593 @override | |
594 void forEachMember(f, | |
595 {includeBackendMembers: false, | |
596 includeSuperAndInjectedMembers: false}) { | |
597 unsupported('forEachMember'); | |
598 } | |
599 | |
600 @override | |
601 void forEachStaticField(f) => unsupported('forEachStaticField'); | |
602 | |
603 @override | |
604 bool get hasBackendMembers => unsupported('hasBackendMembers'); | |
605 | |
606 @override | |
607 bool get hasConstructor => unsupported('hasConstructor'); | |
608 | |
609 @override | |
610 bool hasFieldShadowedBy(fieldMember) => unsupported('hasFieldShadowedBy'); | |
611 | |
612 @override | |
613 bool get hasIncompleteHierarchy => unsupported('hasIncompleteHierarchy'); | |
614 | |
615 @override | |
616 bool get hasLocalScopeMembers => unsupported('hasLocalScopeMembers'); | |
617 | |
618 @override | |
619 int get hierarchyDepth => unsupported('hierarchyDepth'); | |
620 | |
621 @override | |
622 int get id => unsupported('id'); | |
623 | |
624 @override | |
625 bool implementsFunction(compiler) => unsupported('implementsFunction'); | |
626 | |
627 @override | |
628 bool implementsInterface(intrface) => unsupported('implementsInterface'); | |
629 | |
630 @override | |
631 bool get isProxy => unsupported('isProxy'); | |
632 | |
633 @override | |
634 bool isSubclassOf(cls) => unsupported('isSubclassOf'); | |
635 | |
636 @override | |
637 localLookup(String elementName) => unsupported('localLookup'); | |
638 | |
639 @override | |
640 lookupBackendMember(String memberName) => unsupported('lookupBackendMember'); | |
641 | |
642 @override | |
643 lookupClassMember(name) => unsupported('lookupClassMember'); | |
644 | |
645 @override | |
646 lookupConstructor(selector, [noMatch]) => unsupported('lookupConstructor'); | |
647 | |
648 @override | |
649 lookupInterfaceMember(name) => unsupported('lookupInterfaceMember'); | |
650 | |
651 @override | |
652 lookupLocalMember(String memberName) => unsupported('lookupLocalMember'); | |
653 | |
654 @override | |
655 lookupMember(String memberName) => unsupported('lookupMember'); | |
656 | |
657 @override | |
658 lookupByName(dart2js.Name memberName) => unsupported('lookupByName'); | |
659 | |
660 @override | |
661 lookupSuperMember(String memberName) => unsupported('lookupSuperMember'); | |
662 | |
663 @override | |
664 lookupSuperMemberInLibrary(memberName, library) { | |
665 unsupported('lookupSuperMemberInLibrary'); | |
666 } | |
667 | |
668 @override | |
669 lookupSuperByName(dart2js.Name memberName) => | |
670 unsupported('lookupSuperByName'); | |
671 | |
672 @override | |
673 String get nativeTagInfo => unsupported('nativeTagInfo'); | |
674 | |
675 @override | |
676 void reverseBackendMembers() => unsupported('reverseBackendMembers'); | |
677 | |
678 @override | |
679 dart2js.ClassElement get superclass => unsupported('superclass'); | |
680 | |
681 @override | |
682 int get supertypeLoadState => unsupported('supertypeLoadState'); | |
683 | |
684 @override | |
685 dart2js.ConstructorElement lookupDefaultConstructor() => unsupported('lookupDe
faultConstructor'); | |
686 } | |
687 | |
688 class TypedefElementY extends TypeDeclarationElementY | |
689 implements dart2js.TypedefElement { | |
690 | |
691 analyzer.FunctionTypeAliasElement get element => super.element; | |
692 | |
693 dart2js.ElementKind get kind => dart2js.ElementKind.TYPEDEF; | |
694 | |
695 TypedefElementY(ElementConverter converter, | |
696 analyzer.FunctionTypeAliasElement element) | |
697 : super(converter, element); | |
698 | |
699 @override | |
700 dart2js.DartType get alias => unsupported('alias'); | |
701 | |
702 @override | |
703 void checkCyclicReference(compiler) => unsupported('checkCyclicReference'); | |
704 | |
705 @override | |
706 get functionSignature => unsupported('functionSignature'); | |
707 } | |
708 | |
709 abstract class VariableElementMixin | |
710 implements ElementY, dart2js.VariableElement { | |
711 @override | |
712 get initializer => unsupported('initializer'); | |
713 | |
714 @override | |
715 get memberContext => unsupported('memberContext'); | |
716 | |
717 @override | |
718 get constant => unsupported('constant'); | |
719 } | |
720 | |
721 class TopLevelVariableElementY extends ElementY | |
722 with AnalyzableElementY, | |
723 AstElementY, | |
724 TopLevelElementMixin, | |
725 VariableElementMixin, | |
726 MemberElementMixin | |
727 implements dart2js.FieldElement { | |
728 | |
729 analyzer.TopLevelVariableElement get element => super.element; | |
730 | |
731 dart2js.ElementKind get kind => dart2js.ElementKind.FIELD; | |
732 | |
733 @override | |
734 dart2js.DartType get type => converter.convertType(element.type); | |
735 | |
736 @override | |
737 bool get isFinal => element.isFinal; | |
738 | |
739 @override | |
740 bool get isConst => element.isConst; | |
741 | |
742 TopLevelVariableElementY(ElementConverter converter, | |
743 analyzer.TopLevelVariableElement element) | |
744 : super(converter, element); | |
745 | |
746 @override | |
747 get nestedClosures => unsupported('nestedClosures'); | |
748 } | |
749 | |
750 abstract class LocalElementMixin implements ElementY, dart2js.LocalElement { | |
751 | |
752 @override | |
753 bool get isLocal => true; | |
754 | |
755 @override | |
756 bool get isInstanceMember => false; | |
757 | |
758 @override | |
759 bool get isStatic => false; | |
760 | |
761 @override | |
762 bool get isTopLevel => false; | |
763 | |
764 @override | |
765 get executableContext => unsupported('executableContext'); | |
766 | |
767 // TODO(johnniwinther): Ensure the correct semantics of this. | |
768 @override | |
769 bool get isFactoryConstructor => false; | |
770 } | |
771 | |
772 class LocalVariableElementY extends ElementY | |
773 with AnalyzableElementY, | |
774 AstElementY, | |
775 LocalElementMixin, | |
776 VariableElementMixin | |
777 implements dart2js.LocalVariableElement { | |
778 | |
779 analyzer.LocalVariableElement get element => super.element; | |
780 | |
781 dart2js.ElementKind get kind => dart2js.ElementKind.VARIABLE; | |
782 | |
783 @override | |
784 bool get isConst => element.isConst; | |
785 | |
786 LocalVariableElementY(ElementConverter converter, | |
787 analyzer.LocalVariableElement element) | |
788 : super(converter, element); | |
789 | |
790 @override | |
791 dart2js.DartType get type => unsupported('type'); | |
792 } | |
793 | |
794 abstract class ClassMemberMixin implements ElementY { | |
795 analyzer.ClassMemberElement get element; | |
796 | |
797 @override | |
798 dart2js.ClassElement get contextClass => enclosingClass; | |
799 | |
800 @override | |
801 dart2js.ClassElement get enclosingClass { | |
802 return converter.convertElement(element.enclosingElement); | |
803 } | |
804 | |
805 @override | |
806 bool get isClassMember => true; | |
807 | |
808 @override | |
809 bool get isTopLevel => false; | |
810 } | |
811 | |
812 class ConstructorElementY extends ElementY | |
813 with AnalyzableElementY, | |
814 AstElementY, | |
815 FunctionElementMixin, | |
816 ClassMemberMixin, | |
817 MemberElementMixin | |
818 implements dart2js.ConstructorElement { | |
819 | |
820 analyzer.ConstructorElement get element => super.element; | |
821 | |
822 // TODO(johnniwinther): Support redirecting/factory constructors. | |
823 @override | |
824 dart2js.ElementKind get kind => dart2js.ElementKind.GENERATIVE_CONSTRUCTOR; | |
825 | |
826 // TODO(johnniwinther): Support factory constructors. | |
827 @override | |
828 bool get isFactoryConstructor => false; | |
829 | |
830 // TODO(johnniwinther): Support redirecting factory constructors. | |
831 @override | |
832 bool get isRedirectingFactory => false; | |
833 | |
834 // TODO(johnniwinther): Support redirecting generative constructors. | |
835 @override | |
836 bool get isRedirectingGenerative => false; | |
837 | |
838 @override | |
839 bool get isStatic => false; | |
840 | |
841 @override | |
842 bool get isSynthesized => element.isSynthetic; | |
843 | |
844 ConstructorElementY(ElementConverter converter, | |
845 analyzer.ConstructorElement element) | |
846 : super(converter, element); | |
847 | |
848 @override | |
849 computeEffectiveTargetType(_) => unsupported('computeEffectiveTargetType'); | |
850 | |
851 @override | |
852 get definingConstructor => unsupported('definingConstructor'); | |
853 | |
854 @override | |
855 get effectiveTarget => unsupported('effectiveTarget'); | |
856 | |
857 @override | |
858 get immediateRedirectionTarget => unsupported('immediateRedirectionTarget'); | |
859 | |
860 @override | |
861 get nestedClosures => unsupported('nestedClosures'); | |
862 | |
863 @override | |
864 get constantConstructor => unsupported('constantConstructor'); | |
865 | |
866 @override | |
867 get isFromEnvironmentConstructor { | |
868 unsupported('isFromEnvironmentConstructor'); | |
869 } | |
870 | |
871 @override | |
872 bool get isCyclicRedirection => effectiveTarget.isRedirectingFactory; | |
873 | |
874 // TODO(johnniwinther): implement redirectionDeferredPrefix | |
875 @override | |
876 dart2js.PrefixElement get redirectionDeferredPrefix => null; | |
877 } | |
878 | |
879 class InstanceMethodElementY extends ElementY | |
880 with AnalyzableElementY, | |
881 AstElementY, | |
882 FunctionElementMixin, | |
883 ClassMemberMixin, | |
884 MemberElementMixin | |
885 implements dart2js.MethodElement { | |
886 | |
887 analyzer.MethodElement get element => super.element; | |
888 | |
889 @override | |
890 dart2js.ElementKind get kind => dart2js.ElementKind.FUNCTION; | |
891 | |
892 @override | |
893 bool get isStatic => element.isStatic; | |
894 | |
895 @override | |
896 bool get isAbstract => element.isAbstract; | |
897 | |
898 @override | |
899 bool get isFactoryConstructor => false; | |
900 | |
901 @override | |
902 bool get isInstanceMember => true; | |
903 | |
904 InstanceMethodElementY(ElementConverter converter, | |
905 analyzer.MethodElement element) | |
906 : super(converter, element); | |
907 | |
908 @override | |
909 get nestedClosures => unsupported('nestedClosures'); | |
910 } | |
911 | |
912 abstract class MemberElementMixin implements dart2js.MemberElement { | |
913 dart2js.Name get memberName => new dart2js.Name(name, library); | |
914 } | |
OLD | NEW |