speedup
This commit is contained in:
+15
-6
@@ -98,11 +98,13 @@ class BindMacros {
|
||||
|
||||
function iter(t:ClassType) {
|
||||
var meta = t.meta.get();
|
||||
var m = meta.find(function (it) return it.name == BINDABLE_FIELDS);
|
||||
if (m != null) for (a in m.params) {
|
||||
for (m in meta) if (m.name == BINDABLE_FIELDS) {
|
||||
for (a in m.params) {
|
||||
var value = switch a.expr { case EConst(CString(s)): s; case _: null; };
|
||||
interfaceFields.set(value, t);
|
||||
}
|
||||
break;
|
||||
}
|
||||
for (it in t.interfaces) iter(it.t.get());
|
||||
}
|
||||
|
||||
@@ -206,11 +208,18 @@ class BindMacros {
|
||||
static function isFieldBindable(field:Field, fields:Array<Field>, force = false):Bool {
|
||||
if (field.name == "new") return false;
|
||||
|
||||
if (field.access.exists(function (it) return it.equals(AMacro) || it.equals(ADynamic) || it.equals(AStatic))) return false;
|
||||
for (a in field.access)
|
||||
if (a.equals(AMacro) || a.equals(ADynamic) || a.equals(AStatic))
|
||||
return false;
|
||||
|
||||
if (field.name.startsWith("set_") || field.name.startsWith("get_")) {
|
||||
var propName = field.name.substr(4);
|
||||
if (fields.exists(function(it) return it.name == propName)) return false;
|
||||
for (f in fields) if (f.name == propName) {
|
||||
switch (f.kind) {
|
||||
case FVar(_, _): return false;
|
||||
case _:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!force) {
|
||||
@@ -218,8 +227,8 @@ class BindMacros {
|
||||
var forceParam = meta != null ? meta.findParam(FORCE) : null;
|
||||
force = forceParam.isNotNullAndTrue();
|
||||
}
|
||||
if (force)
|
||||
return switch (field.kind) {
|
||||
|
||||
if (force) return switch (field.kind) {
|
||||
case FProp("never", _, _, _): false;
|
||||
case _: true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user