mardi 3 janvier 2017

AS3 source code compile success on Flash Builder does not compile on IntelliJ

We have a AS3 project that can be compiled successfully on Flash Builder 4.7.

Recently I need to refactor it. Since Intellij-idea with flash/flex plugin seems to provides more refactoring assistance, I'd like to try it out.

So I installed Intellij-Idea 2016.3.2 ultimate edition. After importing exsiting project and setting up AIR 4.6.0 sdk (which is found in Flash builder 4.7 installation directory), I can start building.

The problem is that it looks like intellij-idea requires more strict grammar checking than flash builder. Here is some compilation error I met:

The following code will generate: Function does not return a value.

    public static function isChrome2():Boolean{
            try {
                return  false;
            } catch(error:Error) {
                return false;
            }
    }

The following code with generate: duplicate variable definition (as regard to variable tempVertexData)

    public static function setGamePlueVertexData2( vertexData:Vector.<Number> ):void {

            if (SceneReader.NUM_PER_VERTEX == SceneReader.VERTEXSIZE) {
                var tempVertexData:Vector.<Number> = Vector.<Number>(1);
            }
            else {
                var tempVertexData:Vector.<Number> = Vector.<Number>(2);
            }
            for( var i:int = 0; i < tempVertexData.length; ++i )
            {
                vertexData[i] = tempVertexData[i];
            }
        }

The following code will generate: overriding a function that is not marked for override (as regard to function initModel)

    public class EffectRenderObject
    {
        public function initModel(entity:LocalClientEntity) :void 
        {

        }
    }
    public class DragonWhirlwindLevelUpEffectRenderObject extends EffectRenderObject {
        private function initModel():void
        {
        }
    }

Why is it not compile? How can I make it compile again in intellij-idea?

Aucun commentaire:

Enregistrer un commentaire