Do not lose constructor metadata.

This commit is contained in:
back2dos
2015-05-18 14:48:35 +02:00
parent 6b8aefa7ca
commit 78e9087ba2
2 changed files with 4 additions and 2 deletions

View File

@@ -34,7 +34,7 @@ class ClassBuilder {
macros.set(field.name, field) macros.set(field.name, field)
else if (field.name == 'new') { else if (field.name == 'new') {
var m:Member = field; var m:Member = field;
this.constructor = new Constructor(this, m.getFunction().sure(), m.isPublic, m.pos); this.constructor = new Constructor(this, m.getFunction().sure(), m.isPublic, m.pos, m.meta);
} }
else else
addMember(field); addMember(field);

View File

@@ -21,6 +21,7 @@ class Constructor {
var onGenerateHooks:Array<Function->Void>; var onGenerateHooks:Array<Function->Void>;
var superCall:Expr; var superCall:Expr;
var owner:ClassBuilder; var owner:ClassBuilder;
var meta:Metadata;
public var isPublic:Null<Bool>; public var isPublic:Null<Bool>;
public function new(owner:ClassBuilder, f:Function, ?isPublic:Null<Bool> = null, ?pos:Position, ?meta:Metadata) { public function new(owner:ClassBuilder, f:Function, ?isPublic:Null<Bool> = null, ?pos:Position, ?meta:Metadata) {
@@ -33,6 +34,7 @@ class Constructor {
this.args = []; this.args = [];
this.beforeArgs = []; this.beforeArgs = [];
this.afterArgs = []; this.afterArgs = [];
this.meta = meta;
this.oldStatements = this.oldStatements =
if (f == null) []; if (f == null) [];
@@ -129,7 +131,7 @@ class Constructor {
access : isPublic ? [APublic] : [], access : isPublic ? [APublic] : [],
kind : FFun(f), kind : FFun(f),
pos : pos, pos : pos,
meta : [] meta : this.meta,
} }
} }
} }