diff --git a/modules/compiler/src/java/flex2/compiler/as3/binding/BindableFirstPassEvaluator.java b/modules/compiler/src/java/flex2/compiler/as3/binding/BindableFirstPassEvaluator.java index 4657df5ad3..bfde621dbe 100644 --- a/modules/compiler/src/java/flex2/compiler/as3/binding/BindableFirstPassEvaluator.java +++ b/modules/compiler/src/java/flex2/compiler/as3/binding/BindableFirstPassEvaluator.java @@ -249,20 +249,6 @@ public Value evaluate(Context context, ClassDefinitionNode node) { bindableInfo.setClassName(NodeMagic.getUnqualifiedClassName(node)); classMap.put(NodeMagic.getClassName(node), bindableInfo); - //for some reason, bindableInfo.getClassInfo() returns null - //at this point, so we need to get it a different way. - ClassInfo classInfo = typeTable.getSymbolTable().getTypeAnalyzer().analyzeClass(context, new MultiName(NameFormatter.toColon(NodeMagic.getClassName(node)))); - if(classInfo.implementsInterface(standardDefs.PACKAGE_FLASH_EVENTS, GenerativeExtension.IEVENT_DISPATCHER)) - { - NodeMagic.addImport(context, node, NameFormatter.toDot(standardDefs.CLASS_EVENT)); - NodeMagic.addImport(context, node, NameFormatter.toDot(standardDefs.CLASS_EVENTDISPATCHER)); - NodeMagic.addImport(context, node, NameFormatter.toDot(standardDefs.INTERFACE_IEVENTDISPATCHER)); - } - else - { - NodeMagic.addImport(context, node, NameFormatter.toDot(standardDefs.CLASS_STARLING_EVENT)); - NodeMagic.addImport(context, node, NameFormatter.toDot(standardDefs.CLASS_STARLING_EVENTDISPATCHER)); - } NodeMagic.addImport(context, node, NameFormatter.toDot(standardDefs.CLASS_BINDINGMANAGER)); } } @@ -486,20 +472,6 @@ public void registerBindableVariable(Context context, ClassDefinitionNode classN bInfo = new BindableInfo(context, typeTable.getSymbolTable()); bInfo.setClassName(NodeMagic.getUnqualifiedClassName(classNode)); classMap.put(NodeMagic.getClassName(classNode), bInfo); - - ClassInfo classInfo = bInfo.getClassInfo(); - if(classInfo.implementsInterface(StandardDefs.PACKAGE_FLASH_EVENTS, - GenerativeExtension.IEVENT_DISPATCHER)) - { - NodeMagic.addImport(context, classNode, NameFormatter.toDot(standardDefs.CLASS_EVENT)); - NodeMagic.addImport(context, classNode, NameFormatter.toDot(standardDefs.CLASS_EVENTDISPATCHER)); - NodeMagic.addImport(context, classNode, NameFormatter.toDot(standardDefs.INTERFACE_IEVENTDISPATCHER)); - } - else - { - NodeMagic.addImport(context, classNode, NameFormatter.toDot(standardDefs.CLASS_STARLING_EVENT)); - NodeMagic.addImport(context, classNode, NameFormatter.toDot(standardDefs.CLASS_STARLING_EVENTDISPATCHER)); - } NodeMagic.addImport(context, classNode, NameFormatter.toDot(standardDefs.CLASS_BINDINGMANAGER)); } diff --git a/modules/compiler/src/java/flex2/compiler/as3/binding/BindableSecondPassEvaluator.java b/modules/compiler/src/java/flex2/compiler/as3/binding/BindableSecondPassEvaluator.java index 5d122f6461..0a5986d60d 100644 --- a/modules/compiler/src/java/flex2/compiler/as3/binding/BindableSecondPassEvaluator.java +++ b/modules/compiler/src/java/flex2/compiler/as3/binding/BindableSecondPassEvaluator.java @@ -33,6 +33,7 @@ import flex2.compiler.mxml.lang.StandardDefs; import flex2.compiler.util.CompilerMessage; import flex2.compiler.util.MultiName; +import flex2.compiler.util.NameFormatter; import flex2.compiler.util.QName; import macromedia.asc.parser.ArgumentListNode; import macromedia.asc.parser.AttributeListNode; @@ -237,14 +238,20 @@ public Value evaluate(Context context, ClassDefinitionNode node) break; } } + boolean implementsFlashEventDispatcher = classInfo.implementsInterface(standardDefs.PACKAGE_FLASH_EVENTS, GenerativeExtension.IEVENT_DISPATCHER); if (!extendsStarlingEventDispatcher && - !classInfo.implementsInterface(standardDefs.PACKAGE_FLASH_EVENTS, GenerativeExtension.IEVENT_DISPATCHER)) + !implementsFlashEventDispatcher) { //until we figure out how to automatically force a class to //extend EventDispatcher, we need to use a compiler error //instead. context.localizedError2(node.pos(), new BindableClassDoesNotExtendEventDispatcher(classInfo.getClassName())); } + + if(implementsFlashEventDispatcher) + { + NodeMagic.addImport(context, node, NameFormatter.toDot(standardDefs.INTERFACE_IEVENTDISPATCHER)); + } if (bindableInfo.getRequiresStaticEventDispatcher() && (!classInfo.definesVariable(STATIC_EVENT_DISPATCHER) &&