From 66b20bd6bcea249cfd9b994145097696ee0fa130 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 3 Sep 2022 11:56:06 +0200 Subject: [PATCH] Rename Scalar\DNumber to Scalar\Float_ --- UPGRADE-5.0.md | 1 + grammar/php.y | 2 +- lib/PhpParser/BuilderHelpers.php | 2 +- lib/PhpParser/ConstExprEvaluator.php | 2 +- lib/PhpParser/Node/Scalar/DNumber.php | 78 +----------------- lib/PhpParser/Node/Scalar/Float_.php | 82 +++++++++++++++++++ lib/PhpParser/Parser/Php7.php | 2 +- lib/PhpParser/Parser/Php8.php | 2 +- lib/PhpParser/PrettyPrinter/Standard.php | 2 +- test/PhpParser/Builder/ClassConstTest.php | 2 +- test/PhpParser/Builder/InterfaceTest.php | 8 +- test/PhpParser/Builder/ParamTest.php | 2 +- test/PhpParser/Builder/PropertyTest.php | 2 +- test/PhpParser/BuilderHelpersTest.php | 2 +- test/PhpParser/CompatibilityTest.php | 5 ++ test/PhpParser/Node/Scalar/DNumberTest.php | 4 +- test/PhpParser/NodeAbstractTest.php | 4 +- test/PhpParser/NodeTraverserTest.php | 2 +- test/PhpParser/PrettyPrinterTest.php | 8 +- test/code/parser/expr/constant_expr.test | 10 +-- test/code/parser/scalar/explicitOctal.test | 2 +- test/code/parser/scalar/float.test | 30 +++---- test/code/parser/scalar/int.test | 4 +- test/code/parser/scalar/numberSeparators.test | 6 +- .../parser/stmt/class/property_promotion.test | 2 +- test/code/parser/stmt/const.test | 2 +- .../parser/stmt/function/defaultValues.test | 2 +- 27 files changed, 141 insertions(+), 129 deletions(-) create mode 100644 lib/PhpParser/Node/Scalar/Float_.php diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index eaaa0ef2..148663ba 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -75,6 +75,7 @@ used. A number of AST nodes have been renamed or moved in the AST hierarchy: + * `Node\Scalar\DNumber` is now `Node\Scalar\Float_`. * `Node\Expr\ClosureUse` is now `Node\ClosureUse` and no longer extends `Node\Expr`. * `Node\Expr\ArrayItem` is now `Node\ArrayItem` and no longer extends `Node\Expr`. * `Node\Stmt\StaticVar` is now `Node\StaticVar` and no longer extends `Node\Stmt`. diff --git a/grammar/php.y b/grammar/php.y index 31412c79..c9b66f5a 100644 --- a/grammar/php.y +++ b/grammar/php.y @@ -1178,7 +1178,7 @@ dereferencable_scalar: scalar: T_LNUMBER { $$ = $this->parseLNumber($1, attributes(), $this->phpVersion->allowsInvalidOctals()); } - | T_DNUMBER { $$ = Scalar\DNumber::fromString($1, attributes()); } + | T_DNUMBER { $$ = Scalar\Float_::fromString($1, attributes()); } | dereferencable_scalar { $$ = $1; } | constant { $$ = $1; } | class_constant { $$ = $1; } diff --git a/lib/PhpParser/BuilderHelpers.php b/lib/PhpParser/BuilderHelpers.php index a53fe257..ac9b775b 100644 --- a/lib/PhpParser/BuilderHelpers.php +++ b/lib/PhpParser/BuilderHelpers.php @@ -240,7 +240,7 @@ final class BuilderHelpers { } if (is_float($value)) { - return new Scalar\DNumber($value); + return new Scalar\Float_($value); } if (is_string($value)) { diff --git a/lib/PhpParser/ConstExprEvaluator.php b/lib/PhpParser/ConstExprEvaluator.php index 09328880..713c3e89 100644 --- a/lib/PhpParser/ConstExprEvaluator.php +++ b/lib/PhpParser/ConstExprEvaluator.php @@ -103,7 +103,7 @@ class ConstExprEvaluator { private function evaluate(Expr $expr) { if ($expr instanceof Scalar\LNumber - || $expr instanceof Scalar\DNumber + || $expr instanceof Scalar\Float_ || $expr instanceof Scalar\String_ ) { return $expr->value; diff --git a/lib/PhpParser/Node/Scalar/DNumber.php b/lib/PhpParser/Node/Scalar/DNumber.php index 6a524e56..ad3937a5 100644 --- a/lib/PhpParser/Node/Scalar/DNumber.php +++ b/lib/PhpParser/Node/Scalar/DNumber.php @@ -1,79 +1,3 @@ attributes = $attributes; - $this->value = $value; - } - - public function getSubNodeNames(): array { - return ['value']; - } - - /** - * @param mixed[] $attributes - */ - public static function fromString(string $str, array $attributes = []): DNumber { - $attributes['rawValue'] = $str; - $float = self::parse($str); - - return new DNumber($float, $attributes); - } - - /** - * @internal - * - * Parses a DNUMBER token like PHP would. - * - * @param string $str A string number - * - * @return float The parsed number - */ - public static function parse(string $str): float { - $str = str_replace('_', '', $str); - - // if string contains any of .eE just cast it to float - if (false !== strpbrk($str, '.eE')) { - return (float) $str; - } - - // otherwise it's an integer notation that overflowed into a float - // if it starts with 0 it's one of the special integer notations - if ('0' === $str[0]) { - // hex - if ('x' === $str[1] || 'X' === $str[1]) { - return hexdec($str); - } - - // bin - if ('b' === $str[1] || 'B' === $str[1]) { - return bindec($str); - } - - // oct - // substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit (8 or 9) - // so that only the digits before that are used - return octdec(substr($str, 0, strcspn($str, '89'))); - } - - // dec - return (float) $str; - } - - public function getType(): string { - return 'Scalar_DNumber'; - } -} +require __DIR__ . '/Float_.php'; diff --git a/lib/PhpParser/Node/Scalar/Float_.php b/lib/PhpParser/Node/Scalar/Float_.php new file mode 100644 index 00000000..14ade595 --- /dev/null +++ b/lib/PhpParser/Node/Scalar/Float_.php @@ -0,0 +1,82 @@ +attributes = $attributes; + $this->value = $value; + } + + public function getSubNodeNames(): array { + return ['value']; + } + + /** + * @param mixed[] $attributes + */ + public static function fromString(string $str, array $attributes = []): Float_ { + $attributes['rawValue'] = $str; + $float = self::parse($str); + + return new Float_($float, $attributes); + } + + /** + * @internal + * + * Parses a DNUMBER token like PHP would. + * + * @param string $str A string number + * + * @return float The parsed number + */ + public static function parse(string $str): float { + $str = str_replace('_', '', $str); + + // if string contains any of .eE just cast it to float + if (false !== strpbrk($str, '.eE')) { + return (float) $str; + } + + // otherwise it's an integer notation that overflowed into a float + // if it starts with 0 it's one of the special integer notations + if ('0' === $str[0]) { + // hex + if ('x' === $str[1] || 'X' === $str[1]) { + return hexdec($str); + } + + // bin + if ('b' === $str[1] || 'B' === $str[1]) { + return bindec($str); + } + + // oct + // substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit (8 or 9) + // so that only the digits before that are used + return octdec(substr($str, 0, strcspn($str, '89'))); + } + + // dec + return (float) $str; + } + + public function getType(): string { + return 'Scalar_Float'; + } +} + +// @deprecated compatibility alias +class_alias(Float_::class, DNumber::class); diff --git a/lib/PhpParser/Parser/Php7.php b/lib/PhpParser/Parser/Php7.php index 19226852..15f657cf 100644 --- a/lib/PhpParser/Parser/Php7.php +++ b/lib/PhpParser/Parser/Php7.php @@ -2774,7 +2774,7 @@ class Php7 extends \PhpParser\ParserAbstract $this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes, $this->phpVersion->allowsInvalidOctals()); }, 526 => function ($stackPos) { - $this->semValue = Scalar\DNumber::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = Scalar\Float_::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 527 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; diff --git a/lib/PhpParser/Parser/Php8.php b/lib/PhpParser/Parser/Php8.php index 433ed39e..b9ba3516 100644 --- a/lib/PhpParser/Parser/Php8.php +++ b/lib/PhpParser/Parser/Php8.php @@ -2792,7 +2792,7 @@ class Php8 extends \PhpParser\ParserAbstract $this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes, $this->phpVersion->allowsInvalidOctals()); }, 526 => function ($stackPos) { - $this->semValue = Scalar\DNumber::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = Scalar\Float_::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 527 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; diff --git a/lib/PhpParser/PrettyPrinter/Standard.php b/lib/PhpParser/PrettyPrinter/Standard.php index f7229be1..9069dd6b 100644 --- a/lib/PhpParser/PrettyPrinter/Standard.php +++ b/lib/PhpParser/PrettyPrinter/Standard.php @@ -211,7 +211,7 @@ class Standard extends PrettyPrinterAbstract { throw new \Exception('Invalid number kind'); } - protected function pScalar_DNumber(Scalar\DNumber $node) { + protected function pScalar_Float(Scalar\Float_ $node) { if (!is_finite($node->value)) { if ($node->value === \INF) { return '\INF'; diff --git a/test/PhpParser/Builder/ClassConstTest.php b/test/PhpParser/Builder/ClassConstTest.php index 4697cb8c..05ed1215 100644 --- a/test/PhpParser/Builder/ClassConstTest.php +++ b/test/PhpParser/Builder/ClassConstTest.php @@ -173,7 +173,7 @@ class ClassConstTest extends \PHPUnit\Framework\TestCase { ], [ 3.1415, - new Scalar\DNumber(3.1415) + new Scalar\Float_(3.1415) ], [ 'Hallo World', diff --git a/test/PhpParser/Builder/InterfaceTest.php b/test/PhpParser/Builder/InterfaceTest.php index 79e956dd..34ee277e 100644 --- a/test/PhpParser/Builder/InterfaceTest.php +++ b/test/PhpParser/Builder/InterfaceTest.php @@ -9,7 +9,7 @@ use PhpParser\Node\Attribute; use PhpParser\Node\AttributeGroup; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\DNumber; +use PhpParser\Node\Scalar\Float_; use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt; @@ -50,7 +50,7 @@ class InterfaceTest extends \PHPUnit\Framework\TestCase { public function testAddConst() { $const = new Stmt\ClassConst([ - new Node\Const_('SPEED_OF_LIGHT', new DNumber(299792458.0)) + new Node\Const_('SPEED_OF_LIGHT', new Float_(299792458.0)) ]); $contract = $this->createInterfaceBuilder()->addStmt($const)->getNode(); $this->assertSame(299792458.0, $contract->stmts[0]->consts[0]->value->value); @@ -58,7 +58,7 @@ class InterfaceTest extends \PHPUnit\Framework\TestCase { public function testOrder() { $const = new Stmt\ClassConst([ - new Node\Const_('SPEED_OF_LIGHT', new DNumber(299792458)) + new Node\Const_('SPEED_OF_LIGHT', new Float_(299792458)) ]); $method = new Stmt\ClassMethod('doSomething'); $contract = $this->createInterfaceBuilder() @@ -105,7 +105,7 @@ class InterfaceTest extends \PHPUnit\Framework\TestCase { public function testFullFunctional() { $const = new Stmt\ClassConst([ - new Node\Const_('SPEED_OF_LIGHT', new DNumber(299792458)) + new Node\Const_('SPEED_OF_LIGHT', new Float_(299792458)) ]); $method = new Stmt\ClassMethod('doSomething'); $contract = $this->createInterfaceBuilder() diff --git a/test/PhpParser/Builder/ParamTest.php b/test/PhpParser/Builder/ParamTest.php index 9e6fd74c..188c97ea 100644 --- a/test/PhpParser/Builder/ParamTest.php +++ b/test/PhpParser/Builder/ParamTest.php @@ -49,7 +49,7 @@ class ParamTest extends \PHPUnit\Framework\TestCase { ], [ 3.1415, - new Scalar\DNumber(3.1415) + new Scalar\Float_(3.1415) ], [ 'Hallo World', diff --git a/test/PhpParser/Builder/PropertyTest.php b/test/PhpParser/Builder/PropertyTest.php index 597fdf58..f20f66e8 100644 --- a/test/PhpParser/Builder/PropertyTest.php +++ b/test/PhpParser/Builder/PropertyTest.php @@ -156,7 +156,7 @@ class PropertyTest extends \PHPUnit\Framework\TestCase { ], [ 3.1415, - new Scalar\DNumber(3.1415) + new Scalar\Float_(3.1415) ], [ 'Hallo World', diff --git a/test/PhpParser/BuilderHelpersTest.php b/test/PhpParser/BuilderHelpersTest.php index 6baae9a8..ec7d06f5 100644 --- a/test/PhpParser/BuilderHelpersTest.php +++ b/test/PhpParser/BuilderHelpersTest.php @@ -181,7 +181,7 @@ class BuilderHelpersTest extends \PHPUnit\Framework\TestCase { $this->assertEquals(new Expr\ConstFetch(new Node\Name('true')), BuilderHelpers::normalizeValue(true)); $this->assertEquals(new Expr\ConstFetch(new Node\Name('false')), BuilderHelpers::normalizeValue(false)); $this->assertEquals(new Scalar\LNumber(2), BuilderHelpers::normalizeValue(2)); - $this->assertEquals(new Scalar\DNumber(2.5), BuilderHelpers::normalizeValue(2.5)); + $this->assertEquals(new Scalar\Float_(2.5), BuilderHelpers::normalizeValue(2.5)); $this->assertEquals(new Scalar\String_('text'), BuilderHelpers::normalizeValue('text')); $this->assertEquals( new Expr\Array_([ diff --git a/test/PhpParser/CompatibilityTest.php b/test/PhpParser/CompatibilityTest.php index 62aa8699..e32920ab 100644 --- a/test/PhpParser/CompatibilityTest.php +++ b/test/PhpParser/CompatibilityTest.php @@ -3,6 +3,7 @@ namespace PhpParser; use PhpParser\Node\Expr; +use PhpParser\Node\Scalar; use PhpParser\Node\Stmt; class CompatibilityTest extends \PHPUnit\Framework\TestCase { @@ -15,6 +16,8 @@ class CompatibilityTest extends \PHPUnit\Framework\TestCase { $this->assertTrue($node instanceof Expr\ArrayItem); $node = new Node\StaticVar($var); $this->assertTrue($node instanceof Stmt\StaticVar); + $node = new Scalar\Float_(1.0); + $this->assertTrue($node instanceof Scalar\DNumber); } /** @runInSeparateProcess */ @@ -26,5 +29,7 @@ class CompatibilityTest extends \PHPUnit\Framework\TestCase { $this->assertTrue($node instanceof Node\ArrayItem); $node = new Node\Stmt\StaticVar($var); $this->assertTrue($node instanceof Node\StaticVar); + $node = new Node\Scalar\DNumber(1.0); + $this->assertTrue($node instanceof Scalar\Float_); } } diff --git a/test/PhpParser/Node/Scalar/DNumberTest.php b/test/PhpParser/Node/Scalar/DNumberTest.php index 32bcfefc..6563a933 100644 --- a/test/PhpParser/Node/Scalar/DNumberTest.php +++ b/test/PhpParser/Node/Scalar/DNumberTest.php @@ -16,9 +16,9 @@ class DNumberTest extends \PHPUnit\Framework\TestCase { /** @var Echo_ $echo */ $lLumber = $echo->exprs[0]; - $this->assertInstanceOf(DNumber::class, $lLumber); + $this->assertInstanceOf(Float_::class, $lLumber); - /** @var DNumber $dnumber */ + /** @var Float_ $dnumber */ $this->assertSame(1234.56, $lLumber->value); $this->assertSame('1_234.56', $lLumber->getAttribute('rawValue')); } diff --git a/test/PhpParser/NodeAbstractTest.php b/test/PhpParser/NodeAbstractTest.php index b2237a39..27809905 100644 --- a/test/PhpParser/NodeAbstractTest.php +++ b/test/PhpParser/NodeAbstractTest.php @@ -268,7 +268,7 @@ PHP; } }, "default": { - "nodeType": "Scalar_DNumber", + "nodeType": "Scalar_Float", "value": 1, "attributes": { "startLine": 4, @@ -425,7 +425,7 @@ JSON; "name": "b" }, "default": { - "nodeType": "Scalar_DNumber", + "nodeType": "Scalar_Float", "attributes": { "startLine": 4, "endLine": 4, diff --git a/test/PhpParser/NodeTraverserTest.php b/test/PhpParser/NodeTraverserTest.php index 3a63298b..19692522 100644 --- a/test/PhpParser/NodeTraverserTest.php +++ b/test/PhpParser/NodeTraverserTest.php @@ -332,7 +332,7 @@ class NodeTraverserTest extends \PHPUnit\Framework\TestCase { ['leaveNode', $expr, 'foobar'], ]); $visitor5 = new NodeVisitorForTesting([ - ['leaveNode', $num, [new Node\Scalar\DNumber(42.0)]], + ['leaveNode', $num, [new Node\Scalar\Float_(42.0)]], ]); $visitor6 = new NodeVisitorForTesting([ ['leaveNode', $expr, false], diff --git a/test/PhpParser/PrettyPrinterTest.php b/test/PhpParser/PrettyPrinterTest.php index 834c5466..86e77605 100644 --- a/test/PhpParser/PrettyPrinterTest.php +++ b/test/PhpParser/PrettyPrinterTest.php @@ -4,7 +4,7 @@ namespace PhpParser; use PhpParser\Node\Expr; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\DNumber; +use PhpParser\Node\Scalar\Float_; use PhpParser\Node\Scalar\Encapsed; use PhpParser\Node\Scalar\EncapsedStringPart; use PhpParser\Node\Scalar\LNumber; @@ -143,9 +143,9 @@ class PrettyPrinterTest extends CodeTestAbstract { [new LNumber(-1, ['kind' => LNumber::KIND_BIN]), '-0b1'], [new LNumber(-1, ['kind' => LNumber::KIND_OCT]), '-01'], [new LNumber(-1, ['kind' => LNumber::KIND_HEX]), '-0x1'], - [new DNumber(\INF), '\INF'], - [new DNumber(-\INF), '-\INF'], - [new DNumber(-\NAN), '\NAN'], + [new Float_(\INF), '\INF'], + [new Float_(-\INF), '-\INF'], + [new Float_(-\NAN), '\NAN'], ]; } diff --git a/test/code/parser/expr/constant_expr.test b/test/code/parser/expr/constant_expr.test index 31ddab4a..87cb59aa 100644 --- a/test/code/parser/expr/constant_expr.test +++ b/test/code/parser/expr/constant_expr.test @@ -82,10 +82,10 @@ array( name: T_3 ) value: Expr_BinaryOp_Plus( - left: Scalar_DNumber( + left: Scalar_Float( value: 1.5 ) - right: Scalar_DNumber( + right: Scalar_Float( value: 1.5 ) ) @@ -117,10 +117,10 @@ array( ) value: Expr_BinaryOp_Mul( left: Expr_BinaryOp_Plus( - left: Scalar_DNumber( + left: Scalar_Float( value: 1.5 ) - right: Scalar_DNumber( + right: Scalar_Float( value: 1.5 ) ) @@ -151,7 +151,7 @@ array( value: 3 ) ) - right: Scalar_DNumber( + right: Scalar_Float( value: 4 ) ) diff --git a/test/code/parser/scalar/explicitOctal.test b/test/code/parser/scalar/explicitOctal.test index f9bc3a92..b880f9e7 100644 --- a/test/code/parser/scalar/explicitOctal.test +++ b/test/code/parser/scalar/explicitOctal.test @@ -23,7 +23,7 @@ array( ) ) 3: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 9.2233720368548E+18 ) ) diff --git a/test/code/parser/scalar/float.test b/test/code/parser/scalar/float.test index eb9f5b72..54a7b891 100644 --- a/test/code/parser/scalar/float.test +++ b/test/code/parser/scalar/float.test @@ -23,57 +23,57 @@ Different float syntaxes ----- array( 0: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 0 ) ) 1: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 0 ) ) 2: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 0 ) ) 3: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 0 ) ) 4: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 0 ) ) 5: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 0 ) ) 6: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 0 ) ) 7: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 302000000000 ) ) 8: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 3.002E+102 ) ) 9: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: INF ) ) 10: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 1.844674407371E+19 comments: array( 0: // various integer -> float overflows @@ -86,22 +86,22 @@ array( ) ) 11: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 1.844674407371E+19 ) ) 12: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 1.844674407371E+19 ) ) 13: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 1.844674407371E+19 ) ) 14: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 1.844674407371E+19 ) ) diff --git a/test/code/parser/scalar/int.test b/test/code/parser/scalar/int.test index b65858db..ee9eb7ab 100644 --- a/test/code/parser/scalar/int.test +++ b/test/code/parser/scalar/int.test @@ -29,7 +29,7 @@ array( ) ) 3: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: @@{ PHP_INT_MAX + 1 }@@ ) ) @@ -58,4 +58,4 @@ array( value: 3640 ) ) -) \ No newline at end of file +) diff --git a/test/code/parser/scalar/numberSeparators.test b/test/code/parser/scalar/numberSeparators.test index 333c3d69..be944f9f 100644 --- a/test/code/parser/scalar/numberSeparators.test +++ b/test/code/parser/scalar/numberSeparators.test @@ -31,7 +31,7 @@ Syntax error, unexpected T_STRING from 19:2 to 19:4 Syntax error, unexpected T_STRING from 20:2 to 20:4 array( 0: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 6.674083E-11 ) ) @@ -122,12 +122,12 @@ array( ) ) 12: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 0 ) ) 13: Stmt_Expression( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 1 ) ) diff --git a/test/code/parser/stmt/class/property_promotion.test b/test/code/parser/stmt/class/property_promotion.test index 1b0a8f8b..c9b397bc 100644 --- a/test/code/parser/stmt/class/property_promotion.test +++ b/test/code/parser/stmt/class/property_promotion.test @@ -44,7 +44,7 @@ array( var: Expr_Variable( name: x ) - default: Scalar_DNumber( + default: Scalar_Float( value: 0 ) ) diff --git a/test/code/parser/stmt/const.test b/test/code/parser/stmt/const.test index e6c4db84..4d2d4185 100644 --- a/test/code/parser/stmt/const.test +++ b/test/code/parser/stmt/const.test @@ -19,7 +19,7 @@ array( name: Identifier( name: B ) - value: Scalar_DNumber( + value: Scalar_Float( value: 1 ) ) diff --git a/test/code/parser/stmt/function/defaultValues.test b/test/code/parser/stmt/function/defaultValues.test index 2bd34cc0..a66080ab 100644 --- a/test/code/parser/stmt/function/defaultValues.test +++ b/test/code/parser/stmt/function/defaultValues.test @@ -103,7 +103,7 @@ array( name: g ) default: Expr_UnaryMinus( - expr: Scalar_DNumber( + expr: Scalar_Float( value: 1 ) )