I just discovered something:

Foo.as:
package com.acme.foobaz.model{
        [Bindable]public class Foo{
                static public const BAZ:String = “baz”;
        }
}

In some other class:

if(baz == Foo.BAZ){//do something}

compiles to:
if(baz == com.acme.foobaz.model.Foo[“BAZ”])

If you remove the [Bindable] meta tag on the Foo class, it compiles to:
if(baz == com.acme.foobaz.model.Foo.BAZ)

In the debug build, these two are functionally identical. However, when Google 
minifies the file, it has no way of knowing that Foo.BAZ is used. This results 
in calling  (assuming com.acme.foobaz.model.Foo becomes k) k.BAZ even though 
k.BAZ was optimized away and k.BAZ is undefined.

Why does [Bindable] on a class cause the bracket notation to be used?

Harbs

Reply via email to