Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
maybe you need to cast your vector elements: A(items).field
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
there's nothing "hacky" about it. what error, if any, do you see when testing using strict compiler mode?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now