@@ -32,7 +32,7 @@ protected function declaration($name) {
32
32
}
33
33
34
34
/**
35
- * Returns whether a given node is a so-called "static scalar" expression:
35
+ * Returns whether a given node is a constant expression:
36
36
*
37
37
* - Any literal
38
38
* - Arrays where all members are literals
@@ -42,12 +42,12 @@ protected function declaration($name) {
42
42
* @param lang.ast.Node $node
43
43
* @return bool
44
44
*/
45
- protected function staticScalar ($ node ) {
45
+ protected function isConstant ($ node ) {
46
46
if ($ node instanceof Literal) {
47
47
return true ;
48
48
} else if ($ node instanceof ArrayLiteral) {
49
49
foreach ($ node ->values as $ node ) {
50
- if (!$ this ->staticScalar ($ node )) return false ;
50
+ if (!$ this ->isConstant ($ node )) return false ;
51
51
}
52
52
return true ;
53
53
} else if ($ node instanceof ScopeExpression) {
@@ -185,7 +185,7 @@ protected function emitStatic($result, $static) {
185
185
foreach ($ static ->initializations as $ variable => $ initial ) {
186
186
$ result ->out ->write ('static $ ' .$ variable );
187
187
if ($ initial ) {
188
- if ($ this ->staticScalar ($ initial )) {
188
+ if ($ this ->isConstant ($ initial )) {
189
189
$ result ->out ->write ('= ' );
190
190
$ this ->emitOne ($ result , $ initial );
191
191
} else {
@@ -281,7 +281,7 @@ protected function emitParameter($result, $parameter) {
281
281
$ result ->out ->write (($ parameter ->reference ? '& ' : '' ).'$ ' .$ parameter ->name );
282
282
}
283
283
if ($ parameter ->default ) {
284
- if ($ this ->staticScalar ($ parameter ->default )) {
284
+ if ($ this ->isConstant ($ parameter ->default )) {
285
285
$ result ->out ->write ('= ' );
286
286
$ this ->emitOne ($ result , $ parameter ->default );
287
287
} else {
@@ -513,7 +513,7 @@ protected function emitProperty($result, $property) {
513
513
514
514
$ result ->out ->write (implode (' ' , $ property ->modifiers ).' ' .$ this ->propertyType ($ property ->type ).' $ ' .$ property ->name );
515
515
if (isset ($ property ->expression )) {
516
- if ($ this ->staticScalar ($ property ->expression )) {
516
+ if ($ this ->isConstant ($ property ->expression )) {
517
517
$ result ->out ->write ('= ' );
518
518
$ this ->emitOne ($ result , $ property ->expression );
519
519
} else if (in_array ('static ' , $ property ->modifiers )) {
0 commit comments