Skip to content

Commit 8f2c8fc

Browse files
committed
Rename staticScalar() -> isConstant()
1 parent 06c161d commit 8f2c8fc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/php/lang/ast/emit/PHP.class.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function declaration($name) {
3232
}
3333

3434
/**
35-
* Returns whether a given node is a so-called "static scalar" expression:
35+
* Returns whether a given node is a constant expression:
3636
*
3737
* - Any literal
3838
* - Arrays where all members are literals
@@ -42,12 +42,12 @@ protected function declaration($name) {
4242
* @param lang.ast.Node $node
4343
* @return bool
4444
*/
45-
protected function staticScalar($node) {
45+
protected function isConstant($node) {
4646
if ($node instanceof Literal) {
4747
return true;
4848
} else if ($node instanceof ArrayLiteral) {
4949
foreach ($node->values as $node) {
50-
if (!$this->staticScalar($node)) return false;
50+
if (!$this->isConstant($node)) return false;
5151
}
5252
return true;
5353
} else if ($node instanceof ScopeExpression) {
@@ -185,7 +185,7 @@ protected function emitStatic($result, $static) {
185185
foreach ($static->initializations as $variable => $initial) {
186186
$result->out->write('static $'.$variable);
187187
if ($initial) {
188-
if ($this->staticScalar($initial)) {
188+
if ($this->isConstant($initial)) {
189189
$result->out->write('=');
190190
$this->emitOne($result, $initial);
191191
} else {
@@ -281,7 +281,7 @@ protected function emitParameter($result, $parameter) {
281281
$result->out->write(($parameter->reference ? '&' : '').'$'.$parameter->name);
282282
}
283283
if ($parameter->default) {
284-
if ($this->staticScalar($parameter->default)) {
284+
if ($this->isConstant($parameter->default)) {
285285
$result->out->write('=');
286286
$this->emitOne($result, $parameter->default);
287287
} else {
@@ -513,7 +513,7 @@ protected function emitProperty($result, $property) {
513513

514514
$result->out->write(implode(' ', $property->modifiers).' '.$this->propertyType($property->type).' $'.$property->name);
515515
if (isset($property->expression)) {
516-
if ($this->staticScalar($property->expression)) {
516+
if ($this->isConstant($property->expression)) {
517517
$result->out->write('=');
518518
$this->emitOne($result, $property->expression);
519519
} else if (in_array('static', $property->modifiers)) {

0 commit comments

Comments
 (0)