Skip to content

Instantly share code, notes, and snippets.

@jjergus
Created October 11, 2019 19:41
Show Gist options
  • Save jjergus/5df20c7dcfeaeb7032d08bce37e0c9d5 to your computer and use it in GitHub Desktop.
Save jjergus/5df20c7dcfeaeb7032d08bce37e0c9d5 to your computer and use it in GitHub Desktop.
hhast.patch
diff --git a/codegen/inferred_relationships.hack b/codegen/inferred_relationships.hack
index 237f59aa..c80ae11f 100644
--- a/codegen/inferred_relationships.hack
+++ b/codegen/inferred_relationships.hack
@@ -1,7 +1,7 @@
/**
* This file is generated. Do not modify it manually!
*
- * @generated SignedSource<<819c2b4031a964ad0ba680ced0e3cd74>>
+ * @generated SignedSource<<4212321d8474cb6fcc048c4849466df2>>
*/
namespace Facebook\HHAST\__Private;
@@ -451,10 +451,6 @@ const dict<string, keyset<string>> INFERRED_RELATIONSHIPS = dict[
'break_statement.break_keyword' => keyset[
'token:break',
],
- 'break_statement.break_level' => keyset[
- 'literal',
- 'missing',
- ],
'break_statement.break_semicolon' => keyset[
'token:;',
],
@@ -804,6 +800,7 @@ const dict<string, keyset<string>> INFERRED_RELATIONSHIPS = dict[
'list<echo_statement|expression_statement|goto_statement>',
'list<echo_statement|expression_statement|if_statement>',
'list<echo_statement|expression_statement|if_statement|return_statement>',
+ 'list<echo_statement|expression_statement|if_statement|switch_statement>',
'list<echo_statement|expression_statement|if_statement|switch_statement|unset_statement>',
'list<echo_statement|expression_statement|if_statement|try_statement>',
'list<echo_statement|expression_statement|if_statement|unset_statement>',
@@ -1157,10 +1154,6 @@ const dict<string, keyset<string>> INFERRED_RELATIONSHIPS = dict[
'continue_statement.continue_keyword' => keyset[
'token:continue',
],
- 'continue_statement.continue_level' => keyset[
- 'literal',
- 'missing',
- ],
'continue_statement.continue_semicolon' => keyset[
'token:;',
],
@@ -3430,6 +3423,7 @@ const dict<string, keyset<string>> INFERRED_RELATIONSHIPS = dict[
'list<break_statement>',
'list<break_statement|continue_statement>',
'list<break_statement|echo_statement>',
+ 'list<break_statement|echo_statement|expression_statement>',
'list<break_statement|echo_statement|for_statement|switch_statement>',
'list<break_statement|echo_statement|goto_label>',
'list<break_statement|echo_statement|goto_label|goto_statement>',
@@ -3442,6 +3436,7 @@ const dict<string, keyset<string>> INFERRED_RELATIONSHIPS = dict[
'list<break_statement|switch_statement>',
'list<break_statement|throw_statement>',
'list<continue_statement|echo_statement>',
+ 'list<continue_statement|echo_statement|expression_statement>',
'list<do_statement>',
'list<echo_statement>',
'list<echo_statement|expression_statement>',
diff --git a/codegen/schema.json b/codegen/schema.json
index e263eaca..992bd284 100644
--- a/codegen/schema.json
+++ b/codegen/schema.json
@@ -1,6 +1,6 @@
{ "description" :
"@generated JSON schema of the Hack Full Fidelity Parser AST",
- "version" : "2019-10-03-0001",
+ "version" : "2019-10-08-0001",
"trivia" : [
{ "trivia_kind_name" : "WhiteSpace",
"trivia_type_name" : "whitespace" },
@@ -1181,7 +1181,6 @@
"prefix" : "break",
"fields" : [
{ "field_name" : "keyword" },
- { "field_name" : "level" },
{ "field_name" : "semicolon" }
] },
{ "kind_name" : "ContinueStatement",
@@ -1190,7 +1189,6 @@
"prefix" : "continue",
"fields" : [
{ "field_name" : "keyword" },
- { "field_name" : "level" },
{ "field_name" : "semicolon" }
] },
{ "kind_name" : "EchoStatement",
diff --git a/codegen/syntax/BreakStatement.hack b/codegen/syntax/BreakStatement.hack
index 66fdb2fc..a0295d98 100644
--- a/codegen/syntax/BreakStatement.hack
+++ b/codegen/syntax/BreakStatement.hack
@@ -1,7 +1,7 @@
/**
* This file is generated. Do not modify it manually!
*
- * @generated SignedSource<<e5a58ac553ccdaa0ded59f90d2ff39a1>>
+ * @generated SignedSource<<abbf53a9823e00b185b15b002694b293>>
*/
namespace Facebook\HHAST;
use namespace Facebook\TypeAssert;
@@ -13,17 +13,14 @@ final class BreakStatement extends Node implements IStatement {
const string SYNTAX_KIND = 'break_statement';
private BreakToken $_keyword;
- private ?LiteralExpression $_level;
private SemicolonToken $_semicolon;
public function __construct(
BreakToken $keyword,
- ?LiteralExpression $level,
SemicolonToken $semicolon,
?__Private\SourceRef $source_ref = null,
) {
$this->_keyword = $keyword;
- $this->_level = $level;
$this->_semicolon = $semicolon;
parent::__construct($source_ref);
}
@@ -46,14 +43,6 @@ final class BreakStatement extends Node implements IStatement {
);
$keyword = $keyword as nonnull;
$offset += $keyword->getWidth();
- $level = Node::fromJSON(
- /* HH_FIXME[4110] */ $json['break_level'],
- $file,
- $offset,
- $source,
- 'LiteralExpression',
- );
- $offset += $level?->getWidth() ?? 0;
$semicolon = Node::fromJSON(
/* HH_FIXME[4110] */ $json['break_semicolon'],
$file,
@@ -71,7 +60,6 @@ final class BreakStatement extends Node implements IStatement {
);
return new static(
/* HH_IGNORE_ERROR[4110] */ $keyword,
- /* HH_IGNORE_ERROR[4110] */ $level,
/* HH_IGNORE_ERROR[4110] */ $semicolon,
$source_ref,
);
@@ -81,7 +69,6 @@ final class BreakStatement extends Node implements IStatement {
public function getChildren(): dict<string, Node> {
return dict[
'keyword' => $this->_keyword,
- 'level' => $this->_level,
'semicolon' => $this->_semicolon,
]
|> Dict\filter_nulls($$);
@@ -94,18 +81,12 @@ final class BreakStatement extends Node implements IStatement {
): this {
$parents[] = $this;
$keyword = $rewriter($this->_keyword, $parents);
- $level = $this->_level === null ? null : $rewriter($this->_level, $parents);
$semicolon = $rewriter($this->_semicolon, $parents);
- if (
- $keyword === $this->_keyword &&
- $level === $this->_level &&
- $semicolon === $this->_semicolon
- ) {
+ if ($keyword === $this->_keyword && $semicolon === $this->_semicolon) {
return $this;
}
return new static(
/* HH_FIXME[4110] use `as` */ $keyword,
- /* HH_FIXME[4110] use `as` */ $level,
/* HH_FIXME[4110] use `as` */ $semicolon,
);
}
@@ -118,7 +99,7 @@ final class BreakStatement extends Node implements IStatement {
if ($value === $this->_keyword) {
return $this;
}
- return new static($value, $this->_level, $this->_semicolon);
+ return new static($value, $this->_semicolon);
}
public function hasKeyword(): bool {
@@ -139,35 +120,6 @@ final class BreakStatement extends Node implements IStatement {
return $this->getKeyword();
}
- public function getLevelUNTYPED(): ?Node {
- return $this->_level;
- }
-
- public function withLevel(?LiteralExpression $value): this {
- if ($value === $this->_level) {
- return $this;
- }
- return new static($this->_keyword, $value, $this->_semicolon);
- }
-
- public function hasLevel(): bool {
- return $this->_level !== null;
- }
-
- /**
- * @return LiteralExpression | null
- */
- public function getLevel(): ?LiteralExpression {
- return $this->_level;
- }
-
- /**
- * @return LiteralExpression
- */
- public function getLevelx(): LiteralExpression {
- return TypeAssert\not_null($this->getLevel());
- }
-
public function getSemicolonUNTYPED(): ?Node {
return $this->_semicolon;
}
@@ -176,7 +128,7 @@ final class BreakStatement extends Node implements IStatement {
if ($value === $this->_semicolon) {
return $this;
}
- return new static($this->_keyword, $this->_level, $value);
+ return new static($this->_keyword, $value);
}
public function hasSemicolon(): bool {
diff --git a/codegen/syntax/ContinueStatement.hack b/codegen/syntax/ContinueStatement.hack
index ffd0ea0c..78208915 100644
--- a/codegen/syntax/ContinueStatement.hack
+++ b/codegen/syntax/ContinueStatement.hack
@@ -1,7 +1,7 @@
/**
* This file is generated. Do not modify it manually!
*
- * @generated SignedSource<<6774fc608c4be726018db9724ab20e27>>
+ * @generated SignedSource<<6286eaf91f0ff09e2ef4ad15d6e18f31>>
*/
namespace Facebook\HHAST;
use namespace Facebook\TypeAssert;
@@ -13,17 +13,14 @@ final class ContinueStatement extends Node implements IStatement {
const string SYNTAX_KIND = 'continue_statement';
private ContinueToken $_keyword;
- private ?LiteralExpression $_level;
private SemicolonToken $_semicolon;
public function __construct(
ContinueToken $keyword,
- ?LiteralExpression $level,
SemicolonToken $semicolon,
?__Private\SourceRef $source_ref = null,
) {
$this->_keyword = $keyword;
- $this->_level = $level;
$this->_semicolon = $semicolon;
parent::__construct($source_ref);
}
@@ -46,14 +43,6 @@ final class ContinueStatement extends Node implements IStatement {
);
$keyword = $keyword as nonnull;
$offset += $keyword->getWidth();
- $level = Node::fromJSON(
- /* HH_FIXME[4110] */ $json['continue_level'],
- $file,
- $offset,
- $source,
- 'LiteralExpression',
- );
- $offset += $level?->getWidth() ?? 0;
$semicolon = Node::fromJSON(
/* HH_FIXME[4110] */ $json['continue_semicolon'],
$file,
@@ -71,7 +60,6 @@ final class ContinueStatement extends Node implements IStatement {
);
return new static(
/* HH_IGNORE_ERROR[4110] */ $keyword,
- /* HH_IGNORE_ERROR[4110] */ $level,
/* HH_IGNORE_ERROR[4110] */ $semicolon,
$source_ref,
);
@@ -81,7 +69,6 @@ final class ContinueStatement extends Node implements IStatement {
public function getChildren(): dict<string, Node> {
return dict[
'keyword' => $this->_keyword,
- 'level' => $this->_level,
'semicolon' => $this->_semicolon,
]
|> Dict\filter_nulls($$);
@@ -94,18 +81,12 @@ final class ContinueStatement extends Node implements IStatement {
): this {
$parents[] = $this;
$keyword = $rewriter($this->_keyword, $parents);
- $level = $this->_level === null ? null : $rewriter($this->_level, $parents);
$semicolon = $rewriter($this->_semicolon, $parents);
- if (
- $keyword === $this->_keyword &&
- $level === $this->_level &&
- $semicolon === $this->_semicolon
- ) {
+ if ($keyword === $this->_keyword && $semicolon === $this->_semicolon) {
return $this;
}
return new static(
/* HH_FIXME[4110] use `as` */ $keyword,
- /* HH_FIXME[4110] use `as` */ $level,
/* HH_FIXME[4110] use `as` */ $semicolon,
);
}
@@ -118,7 +99,7 @@ final class ContinueStatement extends Node implements IStatement {
if ($value === $this->_keyword) {
return $this;
}
- return new static($value, $this->_level, $this->_semicolon);
+ return new static($value, $this->_semicolon);
}
public function hasKeyword(): bool {
@@ -139,35 +120,6 @@ final class ContinueStatement extends Node implements IStatement {
return $this->getKeyword();
}
- public function getLevelUNTYPED(): ?Node {
- return $this->_level;
- }
-
- public function withLevel(?LiteralExpression $value): this {
- if ($value === $this->_level) {
- return $this;
- }
- return new static($this->_keyword, $value, $this->_semicolon);
- }
-
- public function hasLevel(): bool {
- return $this->_level !== null;
- }
-
- /**
- * @return LiteralExpression | null
- */
- public function getLevel(): ?LiteralExpression {
- return $this->_level;
- }
-
- /**
- * @return LiteralExpression
- */
- public function getLevelx(): LiteralExpression {
- return TypeAssert\not_null($this->getLevel());
- }
-
public function getSemicolonUNTYPED(): ?Node {
return $this->_semicolon;
}
@@ -176,7 +128,7 @@ final class ContinueStatement extends Node implements IStatement {
if ($value === $this->_semicolon) {
return $this;
}
- return new static($this->_keyword, $this->_level, $value);
+ return new static($this->_keyword, $value);
}
public function hasSemicolon(): bool {
diff --git a/codegen/version.hack b/codegen/version.hack
index d9837f09..d166ec24 100644
--- a/codegen/version.hack
+++ b/codegen/version.hack
@@ -1,10 +1,10 @@
/**
* This file is generated. Do not modify it manually!
*
- * @generated SignedSource<<0ffe41f14280dbf9ca2b61cd59106f88>>
+ * @generated SignedSource<<23ff1163a90d47a6fd0859c96ea55da8>>
*/
namespace Facebook\HHAST;
-const string SCHEMA_VERSION = '2019-10-03-0001';
+const string SCHEMA_VERSION = '2019-10-08-0001';
-const int HHVM_VERSION_ID = 42600;
+const int HHVM_VERSION_ID = 42700;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment