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/issuesThanks! :)