diff --git a/uast/types_test.go b/uast/types_test.go index ad1c1d29..c7cf3052 100644 --- a/uast/types_test.go +++ b/uast/types_test.go @@ -71,6 +71,27 @@ var casesToNode = []struct { KeyEnd: expPos(4, 2, 2), }, }, + { + name: "Bool", + obj: Bool{ + GenNode: GenNode{ + Positions: Positions{ + KeyStart: {Offset: 3, Line: 2, Col: 1}, + KeyEnd: {Offset: 8, Line: 2, Col: 6}, + }, + }, + Value: true, + }, + exp: nodes.Object{ + KeyType: nodes.String("uast:Bool"), + KeyPos: nodes.Object{ + KeyType: nodes.String(TypePositions), + KeyStart: expPos(3, 2, 1), + KeyEnd: expPos(8, 2, 6), + }, + "Value": nodes.Bool(true), + }, + }, { name: "Alias", obj: Alias{ diff --git a/uast/uast.go b/uast/uast.go index 04e4ee60..8a0837e9 100644 --- a/uast/uast.go +++ b/uast/uast.go @@ -31,6 +31,7 @@ func init() { GenNode{}, Identifier{}, String{}, + Bool{}, QualifiedIdentifier{}, Comment{}, Group{}, @@ -346,3 +347,9 @@ type Function struct { Type FunctionType `json:"Type"` Body *Block `json:"Body"` } + +// Bool is a boolean literal. +type Bool struct { + GenNode + Value bool `json:"Value"` +}