1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

Construct Syntax as a sum type.

This commit is contained in:
Rob Rix 2015-10-23 17:18:54 -04:00
parent 87cdba8e4b
commit ff21b7d299

View File

@ -229,9 +229,9 @@
}
function Syntax(json, continuation) {
if (json instanceof Array) { this.indexed = new Indexed(json, continuation); }
else if (json instanceof Object) { this.keyed = new Keyed(json, continuation); }
else this.leaf = new Leaf(json);
if (json instanceof Array) { this.indexed = json.map(continuation); }
else if (json instanceof Object) { this.keyed = (new Dictionary(json)).map(continuation); }
else this.leaf = json;
return this;
}