Skip to content

Commit

Permalink
program: deep clone attributes in selectors
Browse files Browse the repository at this point in the history
Otherwise we cannot beta-reduce parameters in them during Genie
generation
  • Loading branch information
gcampax committed Nov 1, 2019
1 parent d32eaa2 commit 1f8cca3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ast/program.js
Expand Up @@ -73,7 +73,8 @@ class DeviceSelector extends Selector {
}

clone() {
return new DeviceSelector(this.kind, this.id, this.principal, this.attributes.slice());
const attributes = this.attributes.map((attr) => attr.clone());
return new DeviceSelector(this.kind, this.id, this.principal, attributes);
}

toString() {
Expand Down
1 change: 1 addition & 0 deletions lib/ast/slots.js
Expand Up @@ -34,6 +34,7 @@ class AbstractSlot {
* @protected
*/
constructor(prim, scope) {
assert(prim || prim === null);
this._prim = prim;


Expand Down

0 comments on commit 1f8cca3

Please sign in to comment.