Closed
Description
Tested in js. Minimal source code files:
// Base.hx
@:autoBuild(Macro.build()) class Base
{
public function new() : Void
{
trace("base");
}
}
// BaseChild.hx
class BaseChild extends Base {}
// BaseChildChild.hx
class BaseChildChild extends BaseChild {}
// Empty.hx
// Macro.hx
class Macro
{
public static function build() : Array<haxe.macro.Expr.Field>
{
haxe.macro.Context.getModule("Empty");
return null;
}
}
// Main.hx
import BaseChildChild;
import BaseChild;
class Main
{
static function main() {}
}
Compile:
haxe -cp src -js bin/index.js -main Main
Generated js:
(function () { "use strict";
function $extend(from, fields) {
function inherit() {}; inherit.prototype = from; var proto = new inherit();
for (var name in fields) proto[name] = fields[name];
if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString;
return proto;
}
var Base = function() {
console.log("base");
};
var BaseChild = function() {
Base.call(this);
};
BaseChild.__super__ = Base;
BaseChild.prototype = $extend(Base.prototype,{
});
var BaseChildChild = function() { }
BaseChildChild.__super__ = BaseChild;
BaseChildChild.prototype = $extend(BaseChild.prototype,{
});
var Main = function() { }
Main.main = function() {
}
Main.main();
})();
Error in line
var BaseChildChild = function() { }
As you can see, super constructor does not called.
Activity