File tree Expand file tree Collapse file tree 3 files changed +0
-66
lines changed Expand file tree Collapse file tree 3 files changed +0
-66
lines changed Original file line number Diff line number Diff line change @@ -48,24 +48,6 @@ func (p *Package) dependsOn(dep Node) bool {
48
48
return done
49
49
}
50
50
51
- // constrainTo destructively constrains p to node.
52
- func (p * Package ) constrainTo (node Node ) {
53
- p .Worlds .All ()(func (name string , w * World ) bool {
54
- if ! DependsOn (w , node ) {
55
- p .Worlds .Delete (name )
56
- return true
57
- }
58
- w .constrainTo (node )
59
- return true
60
- })
61
- p .Interfaces .All ()(func (name string , i * Interface ) bool {
62
- if ! DependsOn (node , i ) {
63
- p .Interfaces .Delete (name )
64
- }
65
- return true
66
- })
67
- }
68
-
69
51
func comparePackages (a , b * Package ) int {
70
52
switch {
71
53
case a == b :
Original file line number Diff line number Diff line change @@ -33,38 +33,6 @@ func (r *Resolve) Clone() *Resolve {
33
33
return & c
34
34
}
35
35
36
- // ConstrainTo destructively modifies the contents of r to only include
37
- // the package(s), world(s), interface(s), and type(s) necessary to
38
- // represent node. The resulting [Resolve] may be used to generate
39
- // minimal WIT to represent node.
40
- // The node argument must be a member of r.
41
- // To preserve data, call Clone first.
42
- func (r * Resolve ) ConstrainTo (node Node ) {
43
- r .Packages = slices .DeleteFunc (r .Packages , func (pkg * Package ) bool {
44
- if ! DependsOn (node , pkg ) && ! DependsOn (pkg , node ) {
45
- return true // delete
46
- }
47
- pkg .constrainTo (node )
48
- return false
49
- })
50
-
51
- r .Worlds = slices .DeleteFunc (r .Worlds , func (w * World ) bool {
52
- if ! DependsOn (w , node ) {
53
- return true // delete
54
- }
55
- w .constrainTo (node )
56
- return false
57
- })
58
-
59
- r .Interfaces = slices .DeleteFunc (r .Interfaces , func (i * Interface ) bool {
60
- return ! DependsOn (node , i )
61
- })
62
-
63
- r .TypeDefs = slices .DeleteFunc (r .TypeDefs , func (t * TypeDef ) bool {
64
- return ! DependsOn (node , t )
65
- })
66
- }
67
-
68
36
// AllFunctions returns a [sequence] that yields each [Function] in a [Resolve].
69
37
// The sequence stops if yield returns false.
70
38
//
Original file line number Diff line number Diff line change @@ -134,22 +134,6 @@ func (w *World) dependsOn(dep Node) bool {
134
134
return done
135
135
}
136
136
137
- // constrainTo destructively constrains w to node.
138
- func (w * World ) constrainTo (node Node ) {
139
- w .Imports .All ()(func (name string , i WorldItem ) bool {
140
- if ! DependsOn (node , i ) {
141
- w .Imports .Delete (name )
142
- }
143
- return true
144
- })
145
- w .Exports .All ()(func (name string , i WorldItem ) bool {
146
- if ! DependsOn (node , i ) {
147
- w .Exports .Delete (name )
148
- }
149
- return true
150
- })
151
- }
152
-
153
137
// A WorldItem is any item that can be exported from or imported into a [World],
154
138
// currently either an [InterfaceRef], [TypeDef], or [Function].
155
139
// Any WorldItem is also a [Node].
You can’t perform that action at this time.
0 commit comments