Skip to content

Commit aba2624

Browse files
committed
What was reported as property is now reported as field (as it seems like it is a field); getter/setters now reported as property
1 parent 3087eef commit aba2624

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Parser/Parser.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,10 @@ private static string GetType(Node node)
366366
case SyntaxKind.ImportDeclaration: return "import";
367367
case SyntaxKind.Constructor:
368368
case SyntaxKind.MethodDeclaration: return "method";
369-
case SyntaxKind.PropertyDeclaration: return "property";
369+
case SyntaxKind.PropertyDeclaration: return "field"; // properties seem to be fields
370370
case SyntaxKind.VariableDeclaration: return node.Parent.Flags == NodeFlags.Const ? "const" : "variable";
371-
case SyntaxKind.GetAccessor: return "getter";
372-
case SyntaxKind.SetAccessor: return "setter";
371+
case SyntaxKind.GetAccessor:
372+
case SyntaxKind.SetAccessor: return "property"; // getter/setter accessors seem to be properties
373373

374374
default:
375375
return kind.ToString();

Tests/ParserTests_AppTs.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,12 @@ public void Element_PropertyDeclaration_matches()
6060
var element = (TerminalNode)declaration.Children[0];
6161

6262
Assert.That(element.Name, Is.EqualTo("element"));
63-
Assert.That(element.Type, Is.EqualTo("property"));
63+
Assert.That(element.Type, Is.EqualTo("field"));
6464
Assert.That(element.LocationSpan, Is.EqualTo(new LocationSpan(new LineInfo(2, 1), new LineInfo(2, 27))), "Wrong location span");
6565
Assert.That(element.Span, Is.EqualTo(new CharacterSpan(17, 43)), "Wrong span");
6666
});
6767
}
6868

69-
[Test]
7069
public void Span_PropertyDeclaration_matches()
7170
{
7271
Assert.Multiple(() =>
@@ -75,7 +74,7 @@ public void Span_PropertyDeclaration_matches()
7574
var element = (TerminalNode)declaration.Children[1];
7675

7776
Assert.That(element.Name, Is.EqualTo("span"));
78-
Assert.That(element.Type, Is.EqualTo("property"));
77+
Assert.That(element.Type, Is.EqualTo("field"));
7978
Assert.That(element.LocationSpan, Is.EqualTo(new LocationSpan(new LineInfo(3, 1), new LineInfo(3, 24))), "Wrong location span");
8079
Assert.That(element.Span, Is.EqualTo(new CharacterSpan(44, 67)), "Wrong span");
8180
});
@@ -90,7 +89,7 @@ public void TimerToken_PropertyDeclaration_matches()
9089
var element = (TerminalNode)declaration.Children[2];
9190

9291
Assert.That(element.Name, Is.EqualTo("timerToken"));
93-
Assert.That(element.Type, Is.EqualTo("property"));
92+
Assert.That(element.Type, Is.EqualTo("field"));
9493
Assert.That(element.LocationSpan, Is.EqualTo(new LocationSpan(new LineInfo(4, 1), new LineInfo(4, 25))), "Wrong location span");
9594
Assert.That(element.Span, Is.EqualTo(new CharacterSpan(68, 92)), "Wrong span");
9695
});

0 commit comments

Comments
 (0)