Support gaining access to the ground object

This commit is contained in:
Tony Garnock-Jones 2016-03-19 15:06:07 -04:00
parent b9aa833186
commit a8b7de0d64
3 changed files with 10 additions and 4 deletions

View File

@ -86,8 +86,13 @@ var modifiedSourceActions = {
return buildActor(ctorExp.asES5, block);
},
NetworkStatement_ground: function(_ground, _network, block) {
return 'new Syndicate.Ground(function () ' + block.asES5 + ').startStepping();';
NetworkStatement_ground: function(_ground, _network, maybeId, block) {
var code = 'new Syndicate.Ground(function () ' + block.asES5 + ').startStepping();';
if (maybeId.numChildren === 1) {
return 'var ' + maybeId.children[0].interval.contents + ' = ' + code;
} else {
return code;
}
},
NetworkStatement_normal: function(_network, block) {
return 'Syndicate.Network.spawn(new Network(function () ' + block.asES5 + '));';

View File

@ -18,8 +18,8 @@ Syndicate <: ES5 {
| actor Block -- noConstructor
NetworkStatement
= ground network Block -- ground
| network Block -- normal
= ground network identifier? Block -- ground
| network Block -- normal
ActorFacetStatement
= state FacetBlock until FacetStateTransitionBlock -- state

View File

@ -37,6 +37,7 @@ Ground.prototype.startStepping = function () {
self.startStepping();
}, 0);
}
return this; // because the syndicatec compiler chains startStepping after the ctor
};
Ground.prototype.stopStepping = function () {