Reuse a constant Discard() instance

This commit is contained in:
Tony Garnock-Jones 2018-11-21 15:10:13 +00:00
parent 1f852a72e7
commit f56cbd9ed3
2 changed files with 3 additions and 1 deletions

View File

@ -33,6 +33,8 @@ Seal.prototype.toJSON = function () {
};
module.exports.Discard = Record.makeConstructor('discard', []);
module.exports.Discard._instance = module.exports.Discard();
module.exports.Capture = Record.makeConstructor('capture', ['specification']);
module.exports.Observe = Record.makeConstructor('observe', ['specification']);

View File

@ -61,7 +61,7 @@ function hasCapturesOrDiscards(nodePath) {
return result;
}
const _discardAst = template.expression(`SYNDICATE.Discard()`);
const _discardAst = template.expression(`SYNDICATE.Discard._instance`);
function discardAst(state) {
return _discardAst({ SYNDICATE: state.SyndicateID });
}