1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 11:04:00 +03:00

Patch is an object.

This commit is contained in:
Rob Rix 2015-10-23 13:48:44 -04:00
parent 0667e3b30e
commit 7adfd32d9d

View File

@ -51,10 +51,11 @@
return node; return node;
} }
function patch(patch) { function Patch(patch) {
if (patch.delete != null) { return new Delete(patch.delete); } if (patch.delete != null) { this.patch = new Delete(patch.delete); }
if (patch.insert != null) { return new Insert(patch.insert); } if (patch.insert != null) { this.patch = new Insert(patch.insert); }
if (patch.replace != null) { return new Replace(patch.replace.before, patch.replace.after); } if (patch.replace != null) { this.patch = new Replace(patch.replace.before, patch.replace.after); }
return this;
} }
function Delete(before) { function Delete(before) {
@ -222,7 +223,7 @@
function Diff(json) { function Diff(json) {
if (json.pure != null) { if (json.pure != null) {
this.pure = patch(json.pure); this.pure = new Patch(json.pure);
} }
if (json.roll != null) { if (json.roll != null) {
this.ranges = json.roll.extract; this.ranges = json.roll.extract;