mirror of
https://github.com/github/semantic.git
synced 2024-11-29 02:44:36 +03:00
Construct Patches with Terms directly.
This commit is contained in:
parent
16876343a4
commit
f00b9cca5b
@ -65,25 +65,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Patch(patch) {
|
function Patch(patch) {
|
||||||
if (patch.delete != null) { this.patch = new Delete(patch.delete); }
|
if (patch.delete != null) { this.before = new Term(patch.delete); }
|
||||||
if (patch.insert != null) { this.patch = new Insert(patch.insert); }
|
if (patch.insert != null) { this.after = new Term(patch.insert); }
|
||||||
if (patch.replace != null) { this.patch = new Replace(patch.replace.before, patch.replace.after); }
|
if (patch.replace != null) {
|
||||||
return this;
|
this.before = new Term(patch.replace.before);
|
||||||
|
this.after = new Term(patch.replace.after);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Delete(before) {
|
|
||||||
this.before = new Term(before);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Insert(after) {
|
|
||||||
this.after = new Term(after);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Replace(before, after) {
|
|
||||||
this.before = new Term(before);
|
|
||||||
this.after = new Term(after);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user