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

Commit c13bfe0

Browse files
committed
ann: add @token for Bool and Num literals; fixes #116
Signed-off-by: Alexander Bezzubov <[email protected]>
1 parent db183c7 commit c13bfe0

File tree

5 files changed

+1392
-2
lines changed

5 files changed

+1392
-2
lines changed

driver/normalizer/annotation.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,19 @@ var Annotations = []Mapping{
262262
AnnotateType("VariableDeclarationStatement", nil, role.Statement, role.Declaration, role.Variable),
263263

264264
// Literals
265-
AnnotateType("BooleanLiteral", nil, role.Expression, role.Literal, role.Boolean),
266265
AnnotateType("TypeLiteral", nil, role.Expression, role.Literal, role.Type),
267-
AnnotateType("NumberLiteral", nil, role.Expression, role.Literal, role.Number),
266+
AnnotateType("BooleanLiteral",
267+
FieldRoles{
268+
"booleanValue": {Rename: uast.KeyToken},
269+
},
270+
role.Expression, role.Literal, role.Boolean,
271+
),
272+
AnnotateType("NumberLiteral",
273+
FieldRoles{
274+
"token": {Rename: uast.KeyToken},
275+
},
276+
role.Expression, role.Literal, role.Number,
277+
),
268278

269279
AnnotateType("NullLiteral",
270280
FieldRoles{

fixtures/issue116_literals.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Test {
2+
int foo = 0;
3+
String bar = "bar";
4+
Class baz = Test.class;
5+
Bool bul = false;
6+
}

0 commit comments

Comments
 (0)