1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 08:25:19 +03:00

Syntax is a type.

This commit is contained in:
Rob Rix 2015-10-23 16:54:49 -04:00
parent 235d70239a
commit 3206f13be0

View File

@ -228,10 +228,11 @@
return this;
}
function syntax(json, continuation) {
if (json instanceof Array) { return new Indexed(json, continuation); }
if (json instanceof Object) { return new Keyed(json, continuation); }
return new Leaf(json);
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);
return this;
}
function Diff(json) {
@ -240,7 +241,7 @@
}
if (json.roll != null) {
this.ranges = json.roll.extract;
this.roll = syntax(json.roll.unwrap, function(x) { return new Diff(x); });
this.roll = new Syntax(json.roll.unwrap, function(x) { return new Diff(x); });
}
return this;
}