codegen/syntax/ParenthesizedExpression.hack (157 lines of code) (raw):

/** * This file is generated. Do not modify it manually! * * @generated SignedSource<<98f2c379fbae3df987c96d97dc7c10b6>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; use namespace HH\Lib\Dict; /* HHAST_IGNORE_ALL[5607] 5607 is ignored because of false positives when comparing a generic to a typed value */ /* HHAST_IGNORE_ALL[5624] HHAST_IGNORE_ALL[5639] 5624 and 5639 are ignored because they insist on using co(tra)variant generics. Could this break external consumers? */ <<__ConsistentConstruct>> final class ParenthesizedExpression extends Node implements ILambdaBody, IExpression { const string SYNTAX_KIND = 'parenthesized_expression'; private LeftParenToken $_left_paren; private IExpression $_expression; private RightParenToken $_right_paren; public function __construct( LeftParenToken $left_paren, IExpression $expression, RightParenToken $right_paren, ?__Private\SourceRef $source_ref = null, ) { $this->_left_paren = $left_paren; $this->_expression = $expression; $this->_right_paren = $right_paren; parent::__construct($source_ref); } <<__Override>> public static function fromJSON( dict<arraykey, mixed> $json, string $file, int $initial_offset, string $source, string $_type_hint, ): this { $offset = $initial_offset; $left_paren = Node::fromJSON( ($json['parenthesized_expression_left_paren']) as dict<_, _>, $file, $offset, $source, 'LeftParenToken', ); $left_paren = $left_paren as nonnull; $offset += $left_paren->getWidth(); $expression = Node::fromJSON( ($json['parenthesized_expression_expression']) as dict<_, _>, $file, $offset, $source, 'IExpression', ); $expression = $expression as nonnull; $offset += $expression->getWidth(); $right_paren = Node::fromJSON( ($json['parenthesized_expression_right_paren']) as dict<_, _>, $file, $offset, $source, 'RightParenToken', ); $right_paren = $right_paren as nonnull; $offset += $right_paren->getWidth(); $source_ref = shape( 'file' => $file, 'source' => $source, 'offset' => $initial_offset, 'width' => $offset - $initial_offset, ); return new static( /* HH_IGNORE_ERROR[4110] */ $left_paren, /* HH_IGNORE_ERROR[4110] */ $expression, /* HH_IGNORE_ERROR[4110] */ $right_paren, $source_ref, ); } <<__Override>> public function getChildren(): dict<string, Node> { return dict[ 'left_paren' => $this->_left_paren, 'expression' => $this->_expression, 'right_paren' => $this->_right_paren, ] |> Dict\filter_nulls($$); } <<__Override>> public function rewriteChildren<Tret as ?Node>( (function(Node, vec<Node>): Tret) $rewriter, vec<Node> $parents = vec[], ): this { $parents[] = $this; $left_paren = $rewriter($this->_left_paren, $parents); $expression = $rewriter($this->_expression, $parents); $right_paren = $rewriter($this->_right_paren, $parents); if ( $left_paren === $this->_left_paren && $expression === $this->_expression && $right_paren === $this->_right_paren ) { return $this; } return new static( $left_paren as LeftParenToken, $expression as IExpression, $right_paren as RightParenToken, ); } public function getLeftParenUNTYPED(): ?Node { return $this->_left_paren; } public function withLeftParen(LeftParenToken $value): this { if ($value === $this->_left_paren) { return $this; } return new static($value, $this->_expression, $this->_right_paren); } public function hasLeftParen(): bool { return true; } /** * @return LeftParenToken */ public function getLeftParen(): LeftParenToken { return TypeAssert\instance_of(LeftParenToken::class, $this->_left_paren); } /** * @return LeftParenToken */ public function getLeftParenx(): LeftParenToken { return $this->getLeftParen(); } public function getExpressionUNTYPED(): ?Node { return $this->_expression; } public function withExpression(IExpression $value): this { if ($value === $this->_expression) { return $this; } return new static($this->_left_paren, $value, $this->_right_paren); } public function hasExpression(): bool { return true; } /** * @return AnonymousFunction | AsExpression | BinaryExpression | * CastExpression | CollectionLiteralExpression | ConditionalExpression | * DarrayIntrinsicExpression | FunctionCallExpression | InclusionExpression | * IsExpression | IssetExpression | LambdaExpression | LiteralExpression | * MemberSelectionExpression | ObjectCreationExpression | * ParenthesizedExpression | PostfixUnaryExpression | PrefixUnaryExpression | * QualifiedName | ScopeResolutionExpression | SubscriptExpression | * NameToken | VariableExpression | VarrayIntrinsicExpression | * VectorIntrinsicExpression | XHPExpression | YieldExpression */ public function getExpression(): IExpression { return TypeAssert\instance_of(IExpression::class, $this->_expression); } /** * @return AnonymousFunction | AsExpression | BinaryExpression | * CastExpression | CollectionLiteralExpression | ConditionalExpression | * DarrayIntrinsicExpression | FunctionCallExpression | InclusionExpression | * IsExpression | IssetExpression | LambdaExpression | LiteralExpression | * MemberSelectionExpression | ObjectCreationExpression | * ParenthesizedExpression | PostfixUnaryExpression | PrefixUnaryExpression | * QualifiedName | ScopeResolutionExpression | SubscriptExpression | * NameToken | VariableExpression | VarrayIntrinsicExpression | * VectorIntrinsicExpression | XHPExpression | YieldExpression */ public function getExpressionx(): IExpression { return $this->getExpression(); } public function getRightParenUNTYPED(): ?Node { return $this->_right_paren; } public function withRightParen(RightParenToken $value): this { if ($value === $this->_right_paren) { return $this; } return new static($this->_left_paren, $this->_expression, $value); } public function hasRightParen(): bool { return true; } /** * @return RightParenToken */ public function getRightParen(): RightParenToken { return TypeAssert\instance_of(RightParenToken::class, $this->_right_paren); } /** * @return RightParenToken */ public function getRightParenx(): RightParenToken { return $this->getRightParen(); } }