Make addMeta fluent. Add toField.

This commit is contained in:
back2dos
2013-12-10 20:49:40 +01:00
parent cc5855883e
commit 9575043ca5

View File

@@ -55,7 +55,7 @@ abstract Member(Field) from Field to Field {
default: pos.makeFailure('Field should be a variable ' + if (pure) '' else 'or property'); default: pos.makeFailure('Field should be a variable ' + if (pure) '' else 'or property');
} }
public function addMeta(name, ?pos, ?params) { public function addMeta(name, ?pos, ?params):Member {
if (this.meta == null) if (this.meta == null)
this.meta = []; this.meta = [];
this.meta.push({ this.meta.push({
@@ -63,6 +63,7 @@ abstract Member(Field) from Field to Field {
pos: if (pos == null) this.pos else pos, pos: if (pos == null) this.pos else pos,
params: if (params == null) [] else params params: if (params == null) [] else params
}); });
return this;
} }
public function extractMeta(name) { public function extractMeta(name) {
@@ -76,6 +77,7 @@ abstract Member(Field) from Field to Field {
return pos.makeFailure('missing @$name'); return pos.makeFailure('missing @$name');
} }
public inline function asField():Field return this;
public function publish() public function publish()
if (this.access == null) this.access = [APublic]; if (this.access == null) this.access = [APublic];
else { else {