@@ -4,8 +4,8 @@ import type { ArtificialAstNode, AstRootNode, IdentifiedRoot, Valid } from '../.
4
4
import { Identified } from '../../../langium-model-server/semantic/model'
5
5
import type { SemanticDomain } from '../../../langium-model-server/semantic/semantic-domain'
6
6
import type * as ast from '../../generated/ast'
7
- import { Transition } from './model'
8
7
import type * as id from '../identity/model'
8
+ import { Transition } from './model'
9
9
10
10
export interface QueriableTaskListSemanticDomain {
11
11
readonly identifiedTasks : ReadonlyMap < string , Identified < ast . Task > >
@@ -39,24 +39,27 @@ export interface TaskListSemanticDomain extends QueriableTaskListSemanticDomain,
39
39
40
40
export namespace TaskListSemanticDomain {
41
41
42
- export function create ( ) {
43
- return new DefaultTaskListSemanticDomain ( )
42
+ export function create ( rootId : string ) {
43
+ return new DefaultTaskListSemanticDomain ( rootId )
44
44
}
45
45
}
46
46
47
47
class DefaultTaskListSemanticDomain implements TaskListSemanticDomain {
48
48
49
+ public readonly rootId : string
50
+
49
51
protected invalidTasks : Set < ast . Task >
50
52
protected invalidReferences : Map < ast . Task , Set < number > >
51
53
52
- private _identifiedRootNode : IdentifiedRoot | undefined
54
+ private _identifiedRoot : IdentifiedRoot | undefined
53
55
private _identifiedTasksById : Map < string , Identified < ast . Task > >
54
56
private _previousIdentifiedTaskById : Map < string , Identified < ast . Task > > | undefined
55
57
private _validTransitionsByIdentifiedTask : Map < Identified < ast . Task > , Transition [ ] >
56
58
private _identifiedTransitionsById : Map < string , Identified < Transition > >
57
59
private _previousIdentifiedTransitionsById : Map < string , Identified < Transition > > | undefined
58
60
59
- constructor ( ) {
61
+ constructor ( rootId : string ) {
62
+ this . rootId = rootId
60
63
this . invalidTasks = new Set ( )
61
64
this . invalidReferences = new Map ( )
62
65
this . _identifiedTasksById = new Map ( )
@@ -103,9 +106,9 @@ class DefaultTaskListSemanticDomain implements TaskListSemanticDomain {
103
106
. flatMap ( this . getValidTransitionsForSourceTask . bind ( this ) )
104
107
}
105
108
106
- public identifyRootNode ( rootNode : AstRootNode , semanticId : string ) : IdentifiedRoot {
107
- this . _identifiedRootNode = Identified . identifyRoot ( rootNode , semanticId )
108
- return this . _identifiedRootNode
109
+ public identifyRoot ( rootNode : AstRootNode ) : IdentifiedRoot {
110
+ this . _identifiedRoot = Identified . identifyRoot ( rootNode , this . rootId )
111
+ return this . _identifiedRoot
109
112
}
110
113
111
114
public identifyTask ( task : Valid < ast . Task > , identity : id . TaskIdentity ) : Identified < ast . Task > {
@@ -120,8 +123,8 @@ class DefaultTaskListSemanticDomain implements TaskListSemanticDomain {
120
123
return identifiedTransition
121
124
}
122
125
123
- get identifiedRootNode ( ) : IdentifiedRoot | undefined {
124
- return this . _identifiedRootNode
126
+ get identifiedRoot ( ) : IdentifiedRoot | undefined {
127
+ return this . _identifiedRoot
125
128
}
126
129
127
130
public get identifiedTasks ( ) : ReadonlyMap < string , Identified < ast . Task > > {
@@ -148,7 +151,7 @@ class DefaultTaskListSemanticDomain implements TaskListSemanticDomain {
148
151
this . _identifiedTasksById = new Map ( )
149
152
this . _previousIdentifiedTransitionsById = this . _identifiedTransitionsById
150
153
this . _identifiedTransitionsById = new Map ( )
151
- this . _identifiedRootNode = undefined
154
+ this . _identifiedRoot = undefined
152
155
}
153
156
154
157
public getIdentifiedNode ( id : string ) : Identified < AstNode | ArtificialAstNode > | undefined {
0 commit comments