Added getVar.

This commit is contained in:
back2dos
2013-09-30 17:08:04 +02:00
parent 5f17f870a1
commit 716f3b3eb9

View File

@@ -47,6 +47,14 @@ abstract Member(Field) from Field to Field {
default: pos.makeFailure('Field should be function');
}
public function getVar(?pure = false)
return
switch kind {
case FVar(t, e): Success({ get: 'default', set: 'default', type: t, expr: e });
case FProp(get, set, t, e) if (!pure): Success({ get: get, set: set, type: t, expr: e });
default: pos.makeFailure('Field should be a variable ' + if (pure) '' else 'or property');
}
public function addMeta(name, ?pos, ?params) {
if (this.meta == null)
this.meta = [];
@@ -65,7 +73,7 @@ abstract Member(Field) from Field to Field {
return Success(tag);
}
}
return Failure('missing @$name');
return pos.makeFailure('missing @$name');
}
public function publish()