Possible bug on SWF target. Where should I post it?

94 views
Skip to first unread message

Hitmark7

unread,
Feb 13, 2016, 4:39:41 AM2/13/16
to Haxe
Hello again, everyone.

I think I've just found a bug for the SWF target on the Haxe Compiler version 3.2.1 for Linux. I reduced the code to this:



// --- Main.hx ---

import haxe.ds.Vector;

class
    VectorWrapper<
        TElement
    >
{

    private var storage:Vector<TElement>;

    public function new(length:Int):Void {
trace("a");
        storage = new Vector<TElement>(length);
trace("b");
trace(storage.length);
trace("c");
    }

}

class
    Main
{

    static public function main():Void {
        var vector:VectorWrapper<Bool> = new VectorWrapper<Bool>(5);
    }

}




This little code works as expected, tracing "a", "b", "5" and "c" for several other targets like Neko or Java, but not for SWF. The resulting file does not trace the "5", nor the "c". The real extended version of the code even throws this:

ReferenceError: Error #1069

Curiosly, the AS3 result looks fine to me:



// --- Main.as ---
// Compile __main__.as instead
package  {
    public class Main {
        static public function main() : void {
            var vector : VectorWrapper = new VectorWrapper(5);
        }
        
    }
}

// --- VectorWrapper ---
package  {
    import haxe.Log;
    import flash.Boot;
    public class VectorWrapper {
        public function VectorWrapper(length : * = null) : void { if( !flash.Boot.skip_constructor ) {
            (haxe.Log._trace)("a",{ fileName : "Main.hx", lineNumber : 13, className : "VectorWrapper", methodName : "new"});
            {
                var length1 : int = length;
                this.storage = new Vector.<*>(length1,true);
            };
            (haxe.Log._trace)("b",{ fileName : "Main.hx", lineNumber : 15, className : "VectorWrapper", methodName : "new"});
            (haxe.Log._trace)(this.storage.length,{ fileName : "Main.hx", lineNumber : 16, className : "VectorWrapper", methodName : "new"});
            (haxe.Log._trace)("c",{ fileName : "Main.hx", lineNumber : 17, className : "VectorWrapper", methodName : "new"});
        }}
        
        protected var storage : *;
    }
}




For quick testing, this is the HTML file I use to load the SWF:



<!DOCTYPE html>
<html lang="en-EN" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-EN">
<head>
    <meta charset="UTF-8" />
    <title>Run SWF</title>

    <style>

        html,
        body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
        }

        body {
            background-color: #ddd;
        }

    </style>

</head>
<body>

    <object
        classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
        width="100%"
        height="100%"
        id="haxe"
        align="middle"
    >
        <param name="movie" value="index.swf"/>
        <param name="allowScriptAccess" value="always" />
        <param name="quality" value="high" />
        <param name="scale" value="noscale" />
        <param name="salign" value="lt" />
        <param name="bgcolor" value="#ffffff"/>
        <embed
            src="index.swf"
            bgcolor="#ffffff"
            width="100%"
            height="100%"
            name="haxe"
            quality="high"
            align="middle"
            allowScriptAccess="always"
            type="application/x-shockwave-flash"
            pluginspage="http://www.macromedia.com/go/getflashplayer"
        />
    </object>

</body>
</html>




Since I'm just a newbie, I'm not sure if this is a real bug. What do you think?

I've been looking for a bug tracker or something for the Haxe Compiler. Should I post this on the GitHub issues section for the Haxe repository? https://github.com/HaxeFoundation/haxe/issues

Thanks! :)

Hitmark7

unread,
Feb 15, 2016, 12:22:03 PM2/15/16
to Haxe
Another example of the bug. I firstly thought it was the SWF Vector length property, but may be not.

import haxe.ds.Vector;

class

   
Wrapper<
       
TElement
   
>
{

   
private var storage:Vector<TElement>;

   
public function new(length:Int):Void {

trace
("b");

        storage
= new Vector<TElement>(length);

trace
("c");
   
}

   
public function set(index:Int, value:TElement):Void {
trace
("e");
        storage
[index] = value;
trace
("f");

   
}

}

class
   
Main
{

   
static public function main():Void {

trace
("a");
       
var w:Wrapper<Float> = new Wrapper<Float>(5);
trace
("d");
        w
.set(0, 2.3);
trace
("g");
   
}

}



The letters "f" and "g" never come out. That is, something happens during the assignation.

Anybody can reproduce the bug, or knows if it is a bug at all?

Thanks.

Atul Kumar

unread,
Feb 15, 2016, 5:08:53 PM2/15/16
to Haxe
I do not know if it helps much.. but at least I can confirm that (when targeting swf) it crashes for me too.

Looks like a bug to me.

Tom

unread,
Feb 16, 2016, 9:11:45 AM2/16/16
to Haxe
The same bug on try.haxe.org. The strange thing is that if you use flash.Vector, then the bug is there, too.

Hitmark7

unread,
Feb 16, 2016, 11:14:53 AM2/16/16
to Haxe


El sábado, 13 de febrero de 2016, 10:39:41 (UTC+1), Hitmark7 escribió:
Reply all
Reply to author
Forward
0 new messages