Browse Source

Bugfix: expression binary operators were dropping children

master
Adam Pippin 3 years ago
parent
commit
9a99fc315b
  1. 8
      app/Cfnpp/Expression/Token/OperatorBinary.php

8
app/Cfnpp/Expression/Token/OperatorBinary.php

@ -102,11 +102,11 @@ class OperatorBinary extends TokenBinary implements ICloudformationNative
} }
elseif (is_scalar($value1)) elseif (is_scalar($value1))
{ {
return $value1 ? $value2 : false; return $value1 ? $arguments[1] : false;
} }
elseif (is_scalar($value2)) elseif (is_scalar($value2))
{ {
return $value2 ? $value1 : false; return $value2 ? $arguments[0] : false;
} }
elseif ($value1 instanceof Parameter && $value2 instanceof Parameter && $value1->getName() == $value2->getName()) elseif ($value1 instanceof Parameter && $value2 instanceof Parameter && $value1->getName() == $value2->getName())
{ {
@ -122,11 +122,11 @@ class OperatorBinary extends TokenBinary implements ICloudformationNative
} }
elseif (is_scalar($value1)) elseif (is_scalar($value1))
{ {
return $value1 ? true : $value1; return $value1 ? true : $arguments[1];
} }
elseif (is_scalar($value2)) elseif (is_scalar($value2))
{ {
return $value2 ? true : $value1; return $value2 ? true : $arguments[0];
} }
elseif ($value1 instanceof Parameter && $value2 instanceof Parameter && $value1->getName() == $value2->getName()) elseif ($value1 instanceof Parameter && $value2 instanceof Parameter && $value1->getName() == $value2->getName())
{ {

Loading…
Cancel
Save