OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of dart2js; | 5 part of dart2js; |
6 | 6 |
7 typedef ItemCompilationContext ItemCompilationContextCreator(); | 7 typedef ItemCompilationContext ItemCompilationContextCreator(); |
8 | 8 |
9 class EnqueueTask extends CompilerTask { | 9 class EnqueueTask extends CompilerTask { |
10 final ResolutionEnqueuer resolution; | 10 final ResolutionEnqueuer resolution; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 registerStaticUse(ctor.declaration); | 313 registerStaticUse(ctor.declaration); |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 /// Enqeue the member [element] if it is required for reflection. | 317 /// Enqeue the member [element] if it is required for reflection. |
318 /// | 318 /// |
319 /// [enclosingWasIncluded] provides a hint whether the enclosing element was | 319 /// [enclosingWasIncluded] provides a hint whether the enclosing element was |
320 /// needed for reflection. | 320 /// needed for reflection. |
321 void enqueueReflectiveMember(Element element, bool enclosingWasIncluded) { | 321 void enqueueReflectiveMember(Element element, bool enclosingWasIncluded) { |
322 if (shouldIncludeElementDueToMirrors(element, | 322 if (shouldIncludeElementDueToMirrors(element, |
323 includedEnclosing: enclosingWasIncluded)) { | 323 includedEnclosing: enclosingWasIncluded) |
| 324 // Do not enqueue typedefs. |
| 325 && !element.impliesType) { |
324 logEnqueueReflectiveAction(element); | 326 logEnqueueReflectiveAction(element); |
325 if (element.isTypedef) { | 327 if (Elements.isStaticOrTopLevel(element)) { |
326 TypedefElement typedef = element; | |
327 typedef.ensureResolved(compiler); | |
328 compiler.world.allTypedefs.add(element); | |
329 } else if (Elements.isStaticOrTopLevel(element)) { | |
330 registerStaticUse(element.declaration); | 328 registerStaticUse(element.declaration); |
331 } else if (element.isInstanceMember) { | 329 } else if (element.isInstanceMember) { |
332 // We need to enqueue all members matching this one in subclasses, as | 330 // We need to enqueue all members matching this one in subclasses, as |
333 // well. | 331 // well. |
334 // TODO(herhut): Use TypedSelector.subtype for enqueueing | 332 // TODO(herhut): Use TypedSelector.subtype for enqueueing |
335 Selector selector = new Selector.fromElement(element, compiler); | 333 Selector selector = new Selector.fromElement(element, compiler); |
336 registerSelectorUse(selector); | 334 registerSelectorUse(selector); |
337 if (element.isField) { | 335 if (element.isField) { |
338 Selector selector = | 336 Selector selector = |
339 new Selector.setter(element.name, element.library); | 337 new Selector.setter(element.name, element.library); |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 } | 849 } |
852 CodegenWorkItem workItem = new CodegenWorkItem( | 850 CodegenWorkItem workItem = new CodegenWorkItem( |
853 element, itemCompilationContextCreator()); | 851 element, itemCompilationContextCreator()); |
854 queue.add(workItem); | 852 queue.add(workItem); |
855 } | 853 } |
856 | 854 |
857 void _logSpecificSummary(log(message)) { | 855 void _logSpecificSummary(log(message)) { |
858 log('Compiled ${generatedCode.length} methods.'); | 856 log('Compiled ${generatedCode.length} methods.'); |
859 } | 857 } |
860 } | 858 } |
OLD | NEW |