Skip to content

Commit

Permalink
Implements SR-11580
Browse files Browse the repository at this point in the history
  • Loading branch information
vermont42 committed Sep 14, 2020
1 parent fc6b14f commit c311e45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions utils/gyb_syntax_support/ExprNodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@
Node('FloatLiteralExpr', kind='Expr',
children=[
Child('FloatingDigits', kind='FloatingLiteralToken'),
]),
],
must_uphold_invariant=True),

Node('TupleExpr', kind='Expr',
traits=['Parenthesized'],
Expand Down Expand Up @@ -282,7 +283,8 @@
Node('IntegerLiteralExpr', kind='Expr',
children=[
Child('Digits', kind='IntegerLiteralToken'),
]),
],
must_uphold_invariant=True),

# true or false
Node('BooleanLiteralExpr', kind='Expr',
Expand Down
5 changes: 4 additions & 1 deletion utils/gyb_syntax_support/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class Node(object):

def __init__(self, name, description=None, kind=None, traits=None,
children=None, element=None, element_name=None,
element_choices=None, omit_when_empty=False):
element_choices=None, omit_when_empty=False,
must_uphold_invariant=False):
self.syntax_kind = name
self.swift_syntax_kind = lowercase_first_word(name)
self.name = kind_to_type(self.syntax_kind)
Expand All @@ -39,6 +40,8 @@ def __init__(self, name, description=None, kind=None, traits=None,

self.omit_when_empty = omit_when_empty
self.collection_element = element or ""
self.must_uphold_invariant = must_uphold_invariant

# For SyntaxCollections make sure that the element_name is set.
assert(not self.is_syntax_collection() or element_name or
(element and element != 'Syntax'))
Expand Down

0 comments on commit c311e45

Please sign in to comment.