@@ -588,10 +588,7 @@ func (n *nodeContext) incompleteErrors() *Bottom {
588
588
for _ , d := range n .dynamicFields {
589
589
err = CombineErrors (nil , err , d .err )
590
590
}
591
- for _ , c := range n .forClauses {
592
- err = CombineErrors (nil , err , c .err )
593
- }
594
- for _ , c := range n .ifClauses {
591
+ for _ , c := range n .comprehensions {
595
592
err = CombineErrors (nil , err , c .err )
596
593
}
597
594
for _ , x := range n .exprs {
@@ -799,11 +796,10 @@ type nodeContext struct {
799
796
notify []* Vertex
800
797
801
798
// Struct information
802
- dynamicFields []envDynamic
803
- ifClauses []envYield
804
- forClauses []envYield
805
- aStruct Expr
806
- aStructID CloseInfo
799
+ dynamicFields []envDynamic
800
+ comprehensions []envYield
801
+ aStruct Expr
802
+ aStructID CloseInfo
807
803
808
804
// Expression conjuncts
809
805
lists []envList
@@ -875,8 +871,7 @@ func (n *nodeContext) clone() *nodeContext {
875
871
d .notify = append (d .notify , n .notify ... )
876
872
d .checks = append (d .checks , n .checks ... )
877
873
d .dynamicFields = append (d .dynamicFields , n .dynamicFields ... )
878
- d .ifClauses = append (d .ifClauses , n .ifClauses ... )
879
- d .forClauses = append (d .forClauses , n .forClauses ... )
874
+ d .comprehensions = append (d .comprehensions , n .comprehensions ... )
880
875
d .lists = append (d .lists , n .lists ... )
881
876
d .vLists = append (d .vLists , n .vLists ... )
882
877
d .exprs = append (d .exprs , n .exprs ... )
@@ -893,24 +888,23 @@ func (c *OpContext) newNodeContext(node *Vertex) *nodeContext {
893
888
c .freeListNode = n .nextFree
894
889
895
890
* n = nodeContext {
896
- ctx : c ,
897
- node : node ,
898
- kind : TopKind ,
899
- usedArcs : n .usedArcs [:0 ],
900
- arcMap : n .arcMap [:0 ],
901
- notify : n .notify [:0 ],
902
- checks : n .checks [:0 ],
903
- dynamicFields : n .dynamicFields [:0 ],
904
- ifClauses : n .ifClauses [:0 ],
905
- forClauses : n .forClauses [:0 ],
906
- lists : n .lists [:0 ],
907
- vLists : n .vLists [:0 ],
908
- exprs : n .exprs [:0 ],
909
- disjunctions : n .disjunctions [:0 ],
910
- usedDefault : n .usedDefault [:0 ],
911
- disjunctErrs : n .disjunctErrs [:0 ],
912
- disjuncts : n .disjuncts [:0 ],
913
- buffer : n .buffer [:0 ],
891
+ ctx : c ,
892
+ node : node ,
893
+ kind : TopKind ,
894
+ usedArcs : n .usedArcs [:0 ],
895
+ arcMap : n .arcMap [:0 ],
896
+ notify : n .notify [:0 ],
897
+ checks : n .checks [:0 ],
898
+ dynamicFields : n .dynamicFields [:0 ],
899
+ comprehensions : n .comprehensions [:0 ],
900
+ lists : n .lists [:0 ],
901
+ vLists : n .vLists [:0 ],
902
+ exprs : n .exprs [:0 ],
903
+ disjunctions : n .disjunctions [:0 ],
904
+ usedDefault : n .usedDefault [:0 ],
905
+ disjunctErrs : n .disjunctErrs [:0 ],
906
+ disjuncts : n .disjuncts [:0 ],
907
+ buffer : n .buffer [:0 ],
914
908
}
915
909
916
910
return n
@@ -1034,8 +1028,7 @@ func (n *nodeContext) updateNodeType(k Kind, v Expr, id CloseInfo) bool {
1034
1028
1035
1029
func (n * nodeContext ) done () bool {
1036
1030
return len (n .dynamicFields ) == 0 &&
1037
- len (n .ifClauses ) == 0 &&
1038
- len (n .forClauses ) == 0 &&
1031
+ len (n .comprehensions ) == 0 &&
1039
1032
len (n .exprs ) == 0
1040
1033
}
1041
1034
@@ -1047,9 +1040,7 @@ func (n *nodeContext) finalDone() bool {
1047
1040
return false
1048
1041
}
1049
1042
}
1050
- return len (n .dynamicFields ) == 0 &&
1051
- len (n .ifClauses ) == 0 &&
1052
- len (n .forClauses ) == 0
1043
+ return len (n .dynamicFields ) == 0 && len (n .comprehensions ) == 0
1053
1044
}
1054
1045
1055
1046
// hasErr is used to determine if an evaluation path, for instance a single
@@ -1752,11 +1743,11 @@ func (n *nodeContext) addStruct(
1752
1743
1753
1744
case * ForClause :
1754
1745
// Why is this not an embedding?
1755
- n .forClauses = append (n .forClauses , envYield {childEnv , x , closeInfo , nil })
1746
+ n .comprehensions = append (n .comprehensions , envYield {childEnv , x , closeInfo , nil })
1756
1747
1757
1748
case Yielder :
1758
1749
// Why is this not an embedding?
1759
- n .ifClauses = append (n .ifClauses , envYield {childEnv , x , closeInfo , nil })
1750
+ n .comprehensions = append (n .comprehensions , envYield {childEnv , x , closeInfo , nil })
1760
1751
1761
1752
case Expr :
1762
1753
// add embedding to optional
@@ -1869,11 +1860,7 @@ func (n *nodeContext) expandOne() (done bool) {
1869
1860
return true
1870
1861
}
1871
1862
1872
- if progress = n .injectEmbedded (& (n .ifClauses )); progress {
1873
- return true
1874
- }
1875
-
1876
- if progress = n .injectEmbedded (& (n .forClauses )); progress {
1863
+ if progress = n .injectComprehensions (& (n .comprehensions )); progress {
1877
1864
return true
1878
1865
}
1879
1866
@@ -1927,10 +1914,8 @@ func (n *nodeContext) injectDynamic() (progress bool) {
1927
1914
return progress
1928
1915
}
1929
1916
1930
- // injectEmbedded evaluates and inserts embeddings. It first evaluates all
1931
- // embeddings before inserting the results to ensure that the order of
1932
- // evaluation does not matter.
1933
- func (n * nodeContext ) injectEmbedded (all * []envYield ) (progress bool ) {
1917
+ // injectComprehensions evaluates and inserts comprehensions.
1918
+ func (n * nodeContext ) injectComprehensions (all * []envYield ) (progress bool ) {
1934
1919
ctx := n .ctx
1935
1920
type envStruct struct {
1936
1921
env * Environment
0 commit comments