Skip to content

Commit 6e7571d

Browse files
committed
Expose some private AST node members
1 parent 7a1ef86 commit 6e7571d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Source/JavaScriptCore/parser/Nodes.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ StatementNode* SourceElements::singleStatement() const
6666
return m_head == m_tail ? m_head : nullptr;
6767
}
6868

69+
StatementNode* SourceElements::firstStatement() const
70+
{
71+
return m_head;
72+
}
73+
6974
StatementNode* SourceElements::lastStatement() const
7075
{
7176
return m_tail;

Source/JavaScriptCore/parser/Nodes.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,7 @@ namespace JSC {
16491649
void append(StatementNode*);
16501650

16511651
StatementNode* singleStatement() const;
1652+
StatementNode* firstStatement() const;
16521653
StatementNode* lastStatement() const;
16531654

16541655
bool hasCompletionValue() const;
@@ -1989,6 +1990,7 @@ namespace JSC {
19891990
return m_numConstants + 2;
19901991
}
19911992

1993+
SourceElements* statements() const { return m_statements; }
19921994
StatementNode* singleStatement() const;
19931995

19941996
bool hasCompletionValue() const override;
@@ -2121,6 +2123,8 @@ namespace JSC {
21212123
class ModuleDeclarationNode : public StatementNode {
21222124
public:
21232125
virtual bool analyzeModule(ModuleAnalyzer&) = 0;
2126+
virtual bool isImportDeclarationNode() const { return false; }
2127+
virtual bool hasAttributesList() const { return false; }
21242128
bool hasCompletionValue() const override { return false; }
21252129
bool isModuleDeclarationNode() const override { return true; }
21262130

@@ -2136,6 +2140,9 @@ namespace JSC {
21362140
};
21372141
ImportDeclarationNode(const JSTokenLocation&, ImportType, ImportSpecifierListNode*, ModuleNameNode*, ImportAttributesListNode*);
21382142

2143+
bool isImportDeclarationNode() const override { return true; }
2144+
bool hasAttributesList() const override { return true; }
2145+
21392146
ImportSpecifierListNode* specifierList() const { return m_specifierList; }
21402147
ModuleNameNode* moduleName() const { return m_moduleName; }
21412148
ImportAttributesListNode* attributesList() const { return m_attributesList; }
@@ -2154,6 +2161,8 @@ namespace JSC {
21542161
public:
21552162
ExportAllDeclarationNode(const JSTokenLocation&, ModuleNameNode*, ImportAttributesListNode*);
21562163

2164+
bool hasAttributesList() const override { return true; }
2165+
21572166
ModuleNameNode* moduleName() const { return m_moduleName; }
21582167
ImportAttributesListNode* attributesList() const { return m_attributesList; }
21592168

@@ -2222,6 +2231,8 @@ namespace JSC {
22222231
public:
22232232
ExportNamedDeclarationNode(const JSTokenLocation&, ExportSpecifierListNode*, ModuleNameNode*, ImportAttributesListNode*);
22242233

2234+
bool hasAttributesList() const override { return true; }
2235+
22252236
ExportSpecifierListNode* specifierList() const { return m_specifierList; }
22262237
ModuleNameNode* moduleName() const { return m_moduleName; }
22272238
ImportAttributesListNode* attributesList() const { return m_attributesList; }

0 commit comments

Comments
 (0)