1+ export class Comment {
2+ constructor ( comment : string ) ;
3+
4+ comment : string ;
5+
6+ readonly isComment : true ;
7+ }
8+
19export class Program {
2- constructor ( ) ;
10+ constructor ( body ?: Statement [ ] ) ;
311
412 body : Statement [ ] ;
513
6- isProgram : true ;
14+ readonly isProgram : true ;
715}
816
917// Boolean seems to be handled as a Unary
@@ -23,11 +31,16 @@ export type Statement =
2331 | FunctionCall
2432 | Return
2533 | Discard
34+ | Continue
35+ | Break
2636 | Accessor
2737 | StaticElement
2838 | DynamicElement
2939 | AccessorElements
3040 | For
41+ | While
42+ | Switch
43+ | SwitchCase
3144 | null ;
3245
3346export class VariableDeclaration {
@@ -46,7 +59,7 @@ export class VariableDeclaration {
4659
4760 immutable : boolean ;
4861
49- isVariableDeclaration : true ;
62+ readonly isVariableDeclaration : true ;
5063}
5164
5265export class Uniform {
@@ -55,7 +68,7 @@ export class Uniform {
5568 type : string ;
5669 name : string ;
5770
58- isUniform : true ;
71+ readonly isUniform : true ;
5972}
6073
6174export class Varying {
@@ -64,7 +77,7 @@ export class Varying {
6477 type : string ;
6578 name : string ;
6679
67- isVarying : true ;
80+ readonly isVarying : true ;
6881}
6982
7083export class FunctionParameter {
@@ -75,26 +88,26 @@ export class FunctionParameter {
7588 qualifier : string | null ;
7689 immutable : boolean ;
7790
78- isFunctionParameter : true ;
91+ readonly isFunctionParameter : true ;
7992}
8093
8194export class FunctionDeclaration {
82- constructor ( type : string , name : string , params ?: FunctionParameter [ ] ) ;
95+ constructor ( type : string , name : string , params ?: FunctionParameter [ ] , body ?: Statement [ ] ) ;
8396
8497 type : string ;
8598 name : string ;
8699 params : FunctionParameter [ ] ;
87100 body : Statement [ ] ;
88101
89- isFunctionDeclaration : true ;
102+ readonly isFunctionDeclaration : true ;
90103}
91104
92105export class Expression {
93106 constructor ( expression : string ) ;
94107
95108 expression : string ;
96109
97- isExpression : true ;
110+ readonly isExpression : true ;
98111}
99112
100113export class Ternary {
@@ -104,7 +117,7 @@ export class Ternary {
104117 left : Statement ;
105118 right : Statement ;
106119
107- isTernary : true ;
120+ readonly isTernary : true ;
108121}
109122
110123export class Operator {
@@ -114,7 +127,7 @@ export class Operator {
114127 left : Statement ;
115128 right : Statement ;
116129
117- isOperator : true ;
130+ readonly isOperator : true ;
118131}
119132
120133export class Unary {
@@ -124,7 +137,7 @@ export class Unary {
124137 expression : Statement ;
125138 after : boolean ;
126139
127- isUnary : true ;
140+ readonly isUnary : true ;
128141}
129142
130143export class Number {
@@ -133,26 +146,25 @@ export class Number {
133146 type : string ;
134147 value : string ;
135148
136- isNumber : true ;
149+ readonly isNumber : true ;
137150}
138151
139152export class String {
140153 constructor ( value : string ) ;
141154
142155 value : string ;
143156
144- isString : true ;
157+ readonly isString : true ;
145158}
146159
147160export class Conditional {
148- constructor ( cond ?: Conditional | null ) ;
161+ constructor ( cond ?: Conditional | null , body ?: Statement [ ] ) ;
149162
150163 cond : Conditional | null ;
151-
152164 body : Statement [ ] ;
153165 elseConditional : Conditional | null ;
154166
155- isConditional : true ;
167+ readonly isConditional : true ;
156168}
157169
158170export class FunctionCall {
@@ -161,57 +173,57 @@ export class FunctionCall {
161173 name : string ;
162174 params : Statement [ ] ;
163175
164- isFunctionCall : true ;
176+ readonly isFunctionCall : true ;
165177}
166178
167179export class Return {
168180 constructor ( value : Statement ) ;
169181
170182 value : Statement ;
171183
172- isReturn : true ;
184+ readonly isReturn : true ;
173185}
174186
175187export class Discard {
176188 constructor ( ) ;
177189
178- isDiscard : true ;
190+ readonly isDiscard : true ;
179191}
180192
181193export class Continue {
182194 constructor ( ) ;
183195
184- isContinue : true ;
196+ readonly isContinue : true ;
185197}
186198
187199export class Break {
188200 constructor ( ) ;
189201
190- isBreak : true ;
202+ readonly isBreak : true ;
191203}
192204
193205export class Accessor {
194206 constructor ( property : string ) ;
195207
196208 property : string ;
197209
198- isAccessor : true ;
210+ readonly isAccessor : true ;
199211}
200212
201213export class StaticElement {
202214 constructor ( value : Statement ) ;
203215
204216 value : Statement ;
205217
206- isStaticElement : true ;
218+ readonly isStaticElement : true ;
207219}
208220
209221export class DynamicElement {
210222 constructor ( value : Statement ) ;
211223
212224 value : Statement ;
213225
214- isDynamicElement : true ;
226+ readonly isDynamicElement : true ;
215227}
216228
217229export class AccessorElements {
@@ -220,40 +232,44 @@ export class AccessorElements {
220232 object : FunctionCall | Accessor ;
221233 elements : ( StaticElement | DynamicElement ) [ ] ;
222234
223- isAccessorElements : true ;
235+ readonly isAccessorElements : true ;
224236}
225237
226238export class For {
227- constructor ( initialization : Statement , condition : Statement , afterthought : Statement ) ;
239+ constructor ( initialization : Statement , condition : Statement , afterthought : Statement , body ?: Statement [ ] ) ;
228240
229241 initialization : Statement ;
230242 condition : Statement ;
231243 afterthought : Statement ;
232-
233244 body : Statement [ ] ;
234245
235- isFor : true ;
246+ readonly isFor : true ;
236247}
237248
238- export class Switch {
239- constructor ( discriminant : Statement ) ;
249+ export class While {
250+ constructor ( condition : Statement , body ?: Statement [ ] ) ;
240251
252+ condition : Statement ;
241253 body : Statement [ ] ;
242254
255+ readonly isWhile : true ;
256+ }
257+
258+ export class Switch {
259+ constructor ( discriminant : Statement , cases : Statement [ ] ) ;
260+
243261 discriminant : Statement ;
244- case : Statement | null ;
245- isSwitch : true ;
262+ cases : Statement [ ] ;
263+
264+ readonly isSwitch : true ;
246265}
247266
248267export class SwitchCase {
249- constructor ( caseCondition : Statement ) ;
250-
251- caseCondition : Statement ;
268+ constructor ( body : Statement , conditions ?: Statement [ ] | null ) ;
252269
253270 body : Statement [ ] ;
254-
255- nextCase : SwitchCase | null ;
271+ conditions : Statement [ ] ;
256272
257273 isDefault : boolean ;
258- isSwitchCase : true ;
274+ readonly isSwitchCase : true ;
259275}
0 commit comments