Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Non-trivial inline cases problem.

New Here ,
Mar 10, 2013 Mar 10, 2013

I have problems when trying to inline functions  that aren't just  trivial expressions using getters or simple math function wrappers. I have AIR SDK 3.6 with stable ASC 2.0.

First problem is somewhat related to array access operator. I have:

class A {

     private var _field:int;

     ...

    [Inline]

    public final function get field():int {

        return _field;

    }

}

...

var items:Vector.<A>;

...

//FIRST CASE -  doesn't work

tmp += items.field;

//SECOND CASE - works!

var item:A = items;

tmp += item.field;

In first case getter won't get inlined, while in second case it will. Why? Vector is typed strongly enough to inferre the type of access operator expression I think.

Second issue:

class B {

     private var _field:int;

     [Inline]

     public final function get field():int {

          return _field;

     }

}

class A {

     public var b:B;

     [Inline]

     public final function get field():int {

          return b.field;

     }

}

var a:A;

tmp = a.field;


The field getter from A won't get inlined. Is this issue already known? How to deal with it. It is serious limitation of inlining feature.

TOPICS
ActionScript
574
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 10, 2013 Mar 10, 2013

maybe you need to cast your vector elements:  A(items).field

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 11, 2013 Mar 11, 2013

It might help in this case, but that's kinda hacky. I'm wondering why inliner won't simply use existing type information. I think it's a bug, or at least missing feature.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 11, 2013 Mar 11, 2013
LATEST

there's nothing "hacky" about it.  what error, if any, do you see when testing using strict compiler mode?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines