custom types work. Now I need to re-implement the test case from 0.5
This commit is contained in:
@@ -7,20 +7,23 @@
|
||||
this._model = _model;
|
||||
}
|
||||
*val (pos) {
|
||||
var t = yield "transaction";
|
||||
if (pos != null) {
|
||||
var o = yield* this.Struct.List.ref(this._model, pos);
|
||||
var o = yield* Y.Struct.List.ref.call(t, this._model, pos);
|
||||
return o ? o.content : null;
|
||||
} else {
|
||||
return yield* this.Struct.List.map(this._model, function(c){return c; });
|
||||
return yield* Y.Struct.List.map.call(t, this._model, function(c){return c; });
|
||||
}
|
||||
}
|
||||
*insert (pos, contents) {
|
||||
yield* this.Struct.List.insert(pos, contents);
|
||||
var t = yield "transaction";
|
||||
yield* Y.Struct.List.insert.call(t, this._model, pos, contents);
|
||||
}
|
||||
}
|
||||
|
||||
Y.List = function* YList(){
|
||||
var model = yield* this.Struct.List.create();
|
||||
var t = yield "transaction";
|
||||
var model = yield* Y.Struct.List.create.call(t, {type: "List"});
|
||||
return new List(model);
|
||||
};
|
||||
Y.List.Create = List;
|
||||
|
||||
@@ -5,21 +5,22 @@
|
||||
this._model = _model;
|
||||
}
|
||||
*val () {
|
||||
var transaction = yield "transaction";
|
||||
var model = yield* transaction.getOperation(this._model);
|
||||
if (arguments.length === 0) {
|
||||
throw new Error("Implement this case!");
|
||||
} else if (arguments.length === 1) {
|
||||
return yield* Y.Struct.Map.get.call(transaction, model, arguments[0]);
|
||||
var t = yield "transaction";
|
||||
var model = yield* t.getOperation(this._model);
|
||||
if (arguments.length === 1) {
|
||||
return yield* Y.Struct.Map.get.call(t, model, arguments[0]);
|
||||
} else if (arguments.length === 2) {
|
||||
return yield* Y.Struct.Map.set.call(t, model, arguments[0], arguments[1]);
|
||||
} else {
|
||||
return yield* Y.Struct.Map.set.call(transaction, model, arguments[0], arguments[1]);
|
||||
throw new Error("Implement this case!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Y.Map = function* YMap(){
|
||||
var t = yield "transaction";
|
||||
if (this instanceof Y.AbstractOperationStore) {
|
||||
var model = yield* Y.Struct.map.create.call(this);
|
||||
var model = yield* Y.Struct.map.create.call(t, {type: "Map"});
|
||||
return new Map(model);
|
||||
} else {
|
||||
throw new Error("Don't use `new` to create this type!");
|
||||
|
||||
Reference in New Issue
Block a user