longsleep / as3-commons

Automatically exported from code.google.com/p/as3-commons
1 stars 1 forks source link

as3commons-bytecode - issue creating metadata against accessors #147

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
as3commons-bytecode does not appear to create metadata definitions against 
accessors.

What steps will reproduce the problem?

(the following code is based on that described at: 
http://www.as3commons.org/as3-commons-bytecode/emit.html)

                                                                var abcBuilder:IAbcBuilder = new AbcBuilder();
                                                                var packageBuilder:IPackageBuilder = abcBuilder.definePackage("com.classes.generated");

                                                                var classBuilder:IClassBuilder = packageBuilder.defineClass("RuntimeClass");

                                                                var accessorBuilder:IAccessorBuilder = classBuilder.defineAccessor("name","String","default");

                                                                var metadataBuilder:IMetadataBuilder = accessorBuilder.defineMetadata("PropertyLevel");
                                                                var metadataArgument:MetadataArgument = metadataBuilder.defineArgument();
                                                                metadataArgument.key = "key";
                                                                metadataArgument.value = "value";

                                                                abcBuilder.addEventListener(Event.COMPLETE, loadedHandler);
                                                                abcBuilder.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
                                                                abcBuilder.addEventListener(IOErrorEvent.VERIFY_ERROR, errorHandler);

                                                                abcBuilder.buildAndLoad();
                                                }

                                                private function loadedHandler(event:Event):void {
                                                                var clazz:Class = ApplicationDomain.currentDomain.getDefinition("com.classes.generated.RuntimeClass") as Class;
                                                                var instance:Object = new clazz();

                                                                trace(describeType(clazz));

                                                }

                                                private function errorHandler(event:Event):void {
                                                }

What is the expected output? What do you see instead?

I'm seeing the following output:

<type name="com.classes.generated::RuntimeClass" base="Class" isDynamic="true" 
isFinal="true" isStatic="true">
  <extendsClass type="Class"/>
  <extendsClass type="Object"/>
  <accessor name="prototype" access="readonly" type="*" declaredBy="Class"/>
  <factory type="com.classes.generated::RuntimeClass">
    <extendsClass type="Object"/>
    <accessor name="name" access="readwrite" type="String" declaredBy="com.classes.generated::RuntimeClass"/>
  </factory>
</type>

I'm expecting to see a metadata definition as a child of the <accessor> 
instance (these appear as expected when I modify the above code to generate a 
Property rather than an Accessor). 

What version of the product are you using? On what operating system?
as3commons-bytecode: 1.1.1
as3commons-reflect 1.6.4
as3commons-logging 2.7
as3commons-lang 0.3.7

O/S: Windows 7 x64
Flash Player 16.0.0.296
Browser: Firefox 36.0.1

Please provide any additional information below.

Any help is greatly appreciated!

Original issue reported on code.google.com by evanlinw...@gmail.com on 13 Mar 2015 at 12:31