-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
699 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import { IR } from "./Ir"; | ||
import { Emitter } from "./Emitter"; | ||
|
||
export class DiffService | ||
{ | ||
constructor( | ||
public readonly ir: IR.Document, | ||
public readonly emitter: Emitter | ||
) {} | ||
} | ||
|
||
export enum DiffKind { | ||
ChildrenAdded, | ||
ChildrenRemoved, | ||
ChildrenRenamed, | ||
InheritanceAdded, | ||
InheritanceRemoved, | ||
DeclarationAdded, | ||
DeclarationRemoved | ||
} | ||
|
||
interface DiffBase { | ||
readonly kind: DiffKind; | ||
} | ||
|
||
export type Diff = | ||
| ChildrenAdded | ||
| ChildrenRemoved | ||
| ChildrenRenamed | ||
| InheritanceAdded | ||
| InheritanceRemoved | ||
| DeclarationAdded | ||
| DeclarationRemoved; | ||
|
||
export class ChildrenAdded implements DiffBase | ||
{ | ||
public readonly kind = DiffKind.ChildrenAdded; | ||
|
||
constructor( | ||
public readonly base: IR.Declaration, | ||
public readonly child: IR.Declaration | ||
) {} | ||
} | ||
|
||
export class ChildrenRemoved implements DiffBase | ||
{ | ||
public readonly kind = DiffKind.ChildrenRemoved; | ||
|
||
constructor( | ||
public readonly base: IR.Declaration, | ||
public readonly child: IR.Declaration | ||
) {} | ||
} | ||
|
||
export class ChildrenRenamed implements DiffBase | ||
{ | ||
public readonly kind = DiffKind.ChildrenRenamed; | ||
|
||
constructor( | ||
public readonly base: IR.Declaration, | ||
public readonly child: IR.Declaration | ||
) {} | ||
} | ||
|
||
export class InheritanceAdded implements DiffBase | ||
{ | ||
public readonly kind = DiffKind.InheritanceAdded; | ||
|
||
constructor( | ||
public readonly base: IR.Declaration, | ||
public readonly name: string | ||
) {} | ||
} | ||
|
||
export class InheritanceRemoved implements DiffBase | ||
{ | ||
public readonly kind = DiffKind.InheritanceRemoved; | ||
|
||
constructor( | ||
public readonly base: IR.Declaration, | ||
public readonly name: string | ||
) {} | ||
} | ||
|
||
export class DeclarationAdded implements DiffBase | ||
{ | ||
public readonly kind = DiffKind.DeclarationAdded; | ||
|
||
constructor(public readonly declaration: IR.Declaration) {} | ||
} | ||
|
||
export class DeclarationRemoved implements DiffBase | ||
{ | ||
public readonly kind = DiffKind.DeclarationRemoved; | ||
|
||
constructor(public readonly declaration: IR.Declaration) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { IR } from "./Ir"; | ||
import { Writer } from "../writer/Writer"; | ||
import * as D from "./DiffService"; | ||
|
||
export abstract class Emitter | ||
{ | ||
constructor( | ||
public readonly ir: IR.Document, | ||
public readonly writer: Writer | ||
) {} | ||
|
||
abstract [D.DiffKind.ChildrenAdded](diff: D.ChildrenAdded): void; | ||
|
||
abstract [D.DiffKind.ChildrenRemoved](diff: D.ChildrenRemoved): void; | ||
|
||
abstract [D.DiffKind.ChildrenRenamed](diff: D.ChildrenRenamed): void; | ||
|
||
abstract [D.DiffKind.InheritanceAdded](diff: D.InheritanceAdded): void; | ||
|
||
abstract [D.DiffKind.InheritanceRemoved](diff: D.InheritanceRemoved): void; | ||
|
||
abstract [D.DiffKind.DeclarationAdded](diff: D.DeclarationAdded): void; | ||
|
||
abstract [D.DiffKind.DeclarationRemoved](diff: D.DeclarationRemoved): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Hello Parsa! | ||
XXX |
Oops, something went wrong.