diff --git a/openrewrite/src/core/markers.ts b/openrewrite/src/core/markers.ts index c5e76741..022ed8d3 100644 --- a/openrewrite/src/core/markers.ts +++ b/openrewrite/src/core/markers.ts @@ -1,7 +1,7 @@ import {random_id, UUID} from "./tree"; export interface Marker { - id(): UUID; + get id(): UUID; withId(id: UUID): Marker; } @@ -17,7 +17,7 @@ export class Markers { this._markers = markers; } - public id(): UUID { + public get id(): UUID { return this._id; } @@ -25,7 +25,7 @@ export class Markers { return this._id === id ? this : new Markers(id, this._markers); } - public markers(): Marker[] { + public get markers(): Marker[] { return this._markers; } diff --git a/openrewrite/src/core/tree.ts b/openrewrite/src/core/tree.ts index 88679ed6..53f298a7 100644 --- a/openrewrite/src/core/tree.ts +++ b/openrewrite/src/core/tree.ts @@ -1,4 +1,5 @@ import {v4 as uuidv4} from 'uuid'; +import {Markers} from "./markers"; export type UUID = string; @@ -6,7 +7,41 @@ export const random_id = (): UUID => { return uuidv4(); } +export interface Tree { + get id(): UUID; + + withId(id: UUID): Tree; + + get markers(): Markers; + + withMarkers(markers: Markers): Tree; + + isAcceptable
(v: TreeVisitor