haxetink / tink_await

Haxe async/await
MIT License
58 stars 15 forks source link

Abstract over an Array #9

Closed kevinresol closed 8 years ago

kevinresol commented 8 years ago

Not sure if this is Haxe's or await's problem:

@:await
class Main {
    @:await static function main() {
        var refs:Refs = [];
        for(ref in refs) trace(@:await tink.core.Future.sync(1));
    }
}
@:forward
abstract Refs(Array<String>) from Array<String> to Array<String> {}

Compile it to js, the generated code for the iterator is var __iterator = refs.iterator(); but iterator is not a valid member of Array, it should instead be var __iterator = HxOverrides.iter(refs);

kevinresol commented 8 years ago

Ok this is a Haxe problem. Removing the inline in LoopIterator's cast function will solve it

kevinresol commented 8 years ago

Tracking on https://github.com/HaxeFoundation/haxe/issues/5385