Minor cleanup.
This commit is contained in:
@@ -14,26 +14,22 @@ class ClassBuilder {
|
||||
var memberList:Array<Member>;
|
||||
var macros:Map<String,Field>;
|
||||
var constructor:Null<Constructor>;
|
||||
public var target(default, null):ClassType;//TODO: this could be lazy
|
||||
public var target(default, null):ClassType;
|
||||
var superFields:Map<String,Bool>;
|
||||
var keepers:Array<Expr>;//hack to force field generation
|
||||
public function new() {
|
||||
|
||||
public function new(?target, ?fields) {
|
||||
if (target == null)
|
||||
target = Context.getLocalClass().get();
|
||||
|
||||
if (fields == null)
|
||||
fields = Context.getBuildFields();
|
||||
|
||||
this.memberMap = new Map();
|
||||
this.memberList = [];
|
||||
this.macros = new Map();
|
||||
this.target = Context.getLocalClass().get();
|
||||
this.target = target;
|
||||
|
||||
switch (target.kind) {
|
||||
case KAbstractImpl(a):
|
||||
//TODO: remove this whole workaround
|
||||
var meta = target.meta;
|
||||
for (tag in a.get().meta.get())
|
||||
if (!meta.has(tag.name))
|
||||
meta.add(tag.name, tag.params, tag.pos);
|
||||
default:
|
||||
}
|
||||
|
||||
for (field in Context.getBuildFields())
|
||||
for (field in fields)
|
||||
if (field.access.has(AMacro))
|
||||
macros.set(field.name, field)
|
||||
else if (field.name == 'new') {
|
||||
|
@@ -21,7 +21,6 @@ class Constructor {
|
||||
var onGenerateHooks:Array<Function->Void>;
|
||||
var superCall:Expr;
|
||||
var owner:ClassBuilder;
|
||||
var keepers:Array<Expr>;//hack to force field generation
|
||||
public var isPublic:Null<Bool>;
|
||||
|
||||
public function new(owner:ClassBuilder, f:Function, ?isPublic:Null<Bool> = null, ?pos:Position, ?meta:Metadata) {
|
||||
@@ -34,7 +33,6 @@ class Constructor {
|
||||
this.args = [];
|
||||
this.beforeArgs = [];
|
||||
this.afterArgs = [];
|
||||
this.keepers = [];
|
||||
|
||||
this.oldStatements =
|
||||
if (f == null) [];
|
||||
@@ -97,11 +95,6 @@ class Constructor {
|
||||
default:
|
||||
}
|
||||
|
||||
if (!Context.defined('js') && Context.defined('dce') && Context.definedValue('dce') == 'full') {
|
||||
if (keepers.length == 0)
|
||||
keepers.push(macro return);
|
||||
keepers.push(macro this.$name = $e);
|
||||
}
|
||||
addStatement(macro @:pos(pos) if (false) { var $tmp = this.$name; $i{tmp} = $e; }, true);
|
||||
addStatement(macro @:pos(pos) (cast this).$name = $e, options.prepend);
|
||||
}
|
||||
@@ -116,7 +109,6 @@ class Constructor {
|
||||
return [superCall]
|
||||
.concat(nuStatements)
|
||||
.concat(oldStatements)
|
||||
.concat(keepers)
|
||||
.toBlock(pos);
|
||||
|
||||
public function onGenerate(hook)
|
||||
|
Reference in New Issue
Block a user