@@ -67,6 +67,19 @@ class InfrastructureScopeTree extends StandardTree, PreOrderTree, PostOrderTree,
67
67
override AstNode getChildNode ( int i ) { result = super .getStatement ( i ) }
68
68
}
69
69
70
+ class StmtsTree extends StandardPostOrderTree instanceof Stmts {
71
+ override AstNode getChildNode ( int i ) {
72
+ //
73
+ i = 0 and result = super .getAChild ( )
74
+ }
75
+ }
76
+
77
+ class ExprTree extends StandardPostOrderTree instanceof Expr {
78
+ override AstNode getChildNode ( int i ) {
79
+ i = 0 and result = super .getAChild ( )
80
+ }
81
+ }
82
+
70
83
/**
71
84
* A literal value in a Bicep program.
72
85
*/
@@ -95,13 +108,18 @@ class StringContentLiteralTree extends LeafTree instanceof StringContentLiteral
95
108
/**
96
109
* ParameterDeclarationTree represents a parameter declaration in a Bicep program.
97
110
*/
98
- class ParameterDeclarationTree extends StandardPostOrderTree instanceof ParameterDeclaration {
99
- override AstNode getChildNode ( int i ) {
100
- i = 0 and result = super .getIdentifier ( )
101
- or
102
- i = 1 and result = super .getType ( )
111
+ class ParameterDeclarationTree extends PreOrderTree instanceof ParameterDeclaration {
112
+ final override predicate propagatesAbnormal ( AstNode child ) { child = super .getIdentifier ( ) }
113
+
114
+ override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
115
+ // Start with the identifier
116
+ pred = this and first ( super .getIdentifier ( ) , succ ) and completionIsSimple ( c )
103
117
or
104
- i = 2 and result = super .getDefaultValue ( )
118
+ last ( super .getIdentifier ( ) , pred , c ) and first ( super .getDefaultValue ( ) , succ ) and completionIsNormal ( c )
119
+ }
120
+
121
+ override predicate last ( AstNode node , Completion c ) {
122
+ node = super .getDefaultValue ( ) and completionIsNormal ( c )
105
123
}
106
124
}
107
125
@@ -117,12 +135,17 @@ class UserDefinedFunctionTree extends StandardPostOrderTree instanceof UserDefin
117
135
}
118
136
}
119
137
120
- class OutputDeclarationTree extends StandardPostOrderTree instanceof OutputDeclaration {
121
- override AstNode getChildNode ( int i ) {
122
- i = 0 and result = super .getIdentifier ( )
123
- or
124
- i = 1 and result = super .getType ( )
138
+ class OutputDeclarationTree extends PreOrderTree instanceof OutputDeclaration {
139
+ final override predicate propagatesAbnormal ( AstNode child ) { child = super .getIdentifier ( ) }
140
+
141
+ override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
142
+ // Start with the identifier
143
+ pred = this and first ( super .getIdentifier ( ) , succ ) and completionIsSimple ( c )
125
144
or
126
- i = 2 and result = super .getValue ( )
145
+ last ( super .getIdentifier ( ) , pred , c ) and first ( super .getValue ( ) , succ ) and completionIsNormal ( c )
146
+ }
147
+
148
+ override predicate last ( AstNode node , Completion c ) {
149
+ node = super .getValue ( ) and completionIsNormal ( c )
127
150
}
128
151
}
0 commit comments