Skip to content

Commit 5494161

Browse files
authored
Merge pull request #60196 from ahoppen/pr/misc-libsyntax-improvements
[libSyntax] Small improvements
2 parents bd003bc + 38278e5 commit 5494161

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

lib/Parse/ParsedSyntaxBuilders.cpp.gyb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ void Parsed${node.name}Builder::finishLayout(bool deferred) {
8585
% if node.children:
8686
% for (idx, child) in enumerate(node.children):
8787
% child_elt = None
88+
% child_elt_name = child.name + 'Member'
8889
% child_node = NODE_MAP.get(child.syntax_kind)
8990
% if child_node and child_node.is_syntax_collection():
9091
% child_elt = child_node.collection_element_name

utils/gyb_syntax_support/Classification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .Node import error
1+
from .Utils import error
22
from .kinds import lowercase_first_word # noqa: I201
33

44

utils/gyb_syntax_support/Node.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
import sys # noqa: I201
2-
1+
from .Utils import error
32
from .kinds import SYNTAX_BASE_KINDS, kind_to_type, lowercase_first_word
43

54

6-
def error(msg):
7-
print('error: ' + msg, file=sys.stderr)
8-
sys.exit(-1)
9-
10-
115
class Node(object):
126
"""
137
A Syntax node, possibly with children.

utils/gyb_syntax_support/NodeSerializationCodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .Node import error
1+
from .Utils import error
22

33

44
SYNTAX_NODE_SERIALIZATION_CODES = {

utils/gyb_syntax_support/Token.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .Classification import classification_by_name
2-
from .Node import error # noqa: I201
2+
from .Utils import error # noqa: I201
33
from .kinds import lowercase_first_word # noqa: I201
44

55

utils/gyb_syntax_support/Trivia.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .Node import error
1+
from .Utils import error
22
from .kinds import lowercase_first_word # noqa: I201
33

44

utils/gyb_syntax_support/Utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import sys
2+
3+
4+
def error(msg):
5+
print('error: ' + msg, file=sys.stderr)
6+
sys.exit(-1)

0 commit comments

Comments
 (0)