Skip to main content
Participant
March 10, 2013
Question

Non-trivial inline cases problem.

  • March 10, 2013
  • 1 reply
  • 611 views

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.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
March 10, 2013

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

Participant
March 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.

kglad
Community Expert
Community Expert
March 11, 2013

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