Skip to content

Commit 3ae2a64

Browse files
authored
fixed LtGt handling when using macro reification, fixes #281 (#282)
1 parent 0b052e5 commit 3ae2a64

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/checkstyle/token/TokenStream.hx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class TokenStream {
9090
case Comma:
9191
case Const(CIdent(_)):
9292
case Kwd(_):
93+
case Dollar(_):
9394
case Binop(OpLt):
9495
case Binop(OpGt): return true;
9596
default: return false;
@@ -224,4 +225,4 @@ class TokenStream {
224225
public function getCurrentPos():Int {
225226
return current;
226227
}
227-
}
228+
}

src/checkstyle/token/walk/WalkTypeNameDef.hx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class WalkTypeNameDef {
2424
name = stream.consumeToken();
2525
case Const(_):
2626
name = stream.consumeConst();
27+
case Dollar(_):
28+
name = stream.consumeToken();
2729
case Sharp(_):
2830
WalkSharp.walkSharp(stream, parent);
2931
return parent.getFirstChild();

test/checks/whitespace/OperatorWhitespaceCheckTest.hx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class OperatorWhitespaceCheckTest extends CheckTestCase<OperatorWhitespaceCheckT
3535
assertNoMsg(check, NEGATIVE_VARS);
3636
assertNoMsg(check, NEGATIVE_NUMS);
3737
assertNoMsg(check, OPGT);
38+
assertNoMsg(check, MACRO_TYPES);
3839
}
3940

4041
public function testIncorrectOperatorWhitespaceToken() {
@@ -445,4 +446,14 @@ abstract OperatorWhitespaceCheckTests(String) to String {
445446
x = a?b:c;
446447
}
447448
}";
449+
450+
var MACRO_TYPES = "
451+
class Test {
452+
function test() {
453+
macro:Array<String>;
454+
var ct = macro:String;
455+
macro:Array<$ct>;
456+
return macro $e + $e;
457+
}
458+
}";
448459
}

0 commit comments

Comments
 (0)