@@ -13,8 +13,8 @@ const log = require('../util/log');
13
13
*/
14
14
class IntermediateStackBlock {
15
15
/**
16
- * @param {import("./enums").StackOpcode } opcode
17
- * @param {Object } inputs
16
+ * @param {import("./enums").StackOpcode } opcode
17
+ * @param {Object } inputs
18
18
* @param {boolean } yields
19
19
*/
20
20
constructor ( opcode , inputs = { } , yields = false ) {
@@ -26,7 +26,7 @@ class IntermediateStackBlock {
26
26
27
27
/**
28
28
* The inputs of this block.
29
- * @type {Object }
29
+ * @type {Object }
30
30
*/
31
31
this . inputs = inputs ;
32
32
@@ -36,6 +36,12 @@ class IntermediateStackBlock {
36
36
*/
37
37
this . yields = yields ;
38
38
39
+ /**
40
+ * Should state changes made by this stack block be ignored? Used for testing.
41
+ * @type {boolean }
42
+ */
43
+ this . ignoreState = false ;
44
+
39
45
/**
40
46
* @type {import("./iroptimizer").TypeState? }
41
47
*/
@@ -66,9 +72,9 @@ class IntermediateInput {
66
72
}
67
73
68
74
/**
69
- * @param {InputOpcode } opcode
75
+ * @param {InputOpcode } opcode
70
76
* @param {InputType } type
71
- * @param {Object } inputs
77
+ * @param {Object } inputs
72
78
* @param {boolean } yields
73
79
*/
74
80
constructor ( opcode , type , inputs = { } , yields = false ) {
@@ -107,7 +113,7 @@ class IntermediateInput {
107
113
108
114
/**
109
115
* Is the type of this input guaranteed to always be the type at runtime.
110
- * @param {InputType } type
116
+ * @param {InputType } type
111
117
* @returns {boolean }
112
118
*/
113
119
isAlwaysType ( type ) {
@@ -116,8 +122,8 @@ class IntermediateInput {
116
122
117
123
/**
118
124
* Is it possible for this input to be the type at runtime.
119
- * @param {InputType } type
120
- * @returns
125
+ * @param {InputType } type
126
+ * @returns
121
127
*/
122
128
isSometimesType ( type ) {
123
129
return ( this . type & type ) !== 0 ;
@@ -127,7 +133,7 @@ class IntermediateInput {
127
133
* Converts this input to a target type.
128
134
* If this input is a constant the conversion is performed now, at compile time.
129
135
* If the input changes, the conversion is performed at runtime.
130
- * @param {InputType } targetType
136
+ * @param {InputType } targetType
131
137
* @returns {IntermediateInput } An input with the new type.
132
138
*/
133
139
toType ( targetType ) {
@@ -277,11 +283,18 @@ class IntermediateScript {
277
283
*/
278
284
this . cachedCompileResult = null ;
279
285
286
+ /**
287
+ * Cached result of analysing this script.
288
+ * @type {import("./iroptimizer").TypeState|null }
289
+ */
290
+ this . cachedAnalysisEndState = null ;
291
+
280
292
/**
281
293
* Whether the top block of this script is an executable hat.
282
294
* @type {boolean }
283
295
*/
284
296
this . executableHat = false ;
297
+
285
298
}
286
299
}
287
300
@@ -290,9 +303,9 @@ class IntermediateScript {
290
303
*/
291
304
class IntermediateRepresentation {
292
305
/**
293
- *
294
- * @param {IntermediateScript } entry
295
- * @param {Object.<string, IntermediateScript> } procedures
306
+ *
307
+ * @param {IntermediateScript } entry
308
+ * @param {Object.<string, IntermediateScript> } procedures
296
309
*/
297
310
constructor ( entry , procedures ) {
298
311
/**
0 commit comments