Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 95957ad

Browse files
Denys Smirnovdennwc
authored andcommitted
uast: define Bool node (boolean literal)
Signed-off-by: Denys Smirnov <[email protected]>
1 parent 010d49a commit 95957ad

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

uast/types_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,27 @@ var casesToNode = []struct {
7171
KeyEnd: expPos(4, 2, 2),
7272
},
7373
},
74+
{
75+
name: "Bool",
76+
obj: Bool{
77+
GenNode: GenNode{
78+
Positions: Positions{
79+
KeyStart: {Offset: 3, Line: 2, Col: 1},
80+
KeyEnd: {Offset: 8, Line: 2, Col: 6},
81+
},
82+
},
83+
Value: true,
84+
},
85+
exp: nodes.Object{
86+
KeyType: nodes.String("uast:Bool"),
87+
KeyPos: nodes.Object{
88+
KeyType: nodes.String(TypePositions),
89+
KeyStart: expPos(3, 2, 1),
90+
KeyEnd: expPos(8, 2, 6),
91+
},
92+
"Value": nodes.Bool(true),
93+
},
94+
},
7495
{
7596
name: "Alias",
7697
obj: Alias{

uast/uast.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func init() {
3131
GenNode{},
3232
Identifier{},
3333
String{},
34+
Bool{},
3435
QualifiedIdentifier{},
3536
Comment{},
3637
Group{},
@@ -584,3 +585,9 @@ type Function struct {
584585
// TODO: we don't have return statements yet
585586
Body *Block `json:"Body"`
586587
}
588+
589+
// Bool is a boolean literal.
590+
type Bool struct {
591+
GenNode
592+
Value bool `json:"Value"`
593+
}

0 commit comments

Comments
 (0)