Skip to content

Commit c109be6

Browse files
authored
allow identifier names with leading dollar (#321)
1 parent 045c141 commit c109be6

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/checkstyle/token/TokenStream.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class TokenStream {
3535

3636
public function consumeConstIdent():TokenTree {
3737
switch (token()) {
38+
case Dollar(_): return consumeToken();
3839
case Const(CIdent(_)): return consumeToken();
3940
default: error('bad token ${token()} != Const(CIdent(_))');
4041
}

test/token/TokenTreeBuilderParsingTest.hx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class TokenTreeBuilderParsingTest extends haxe.unit.TestCase {
2121
assertCodeParses(ISSUE_252);
2222
assertCodeParses(ISSUE_253);
2323
assertCodeParses(ISSUE_256);
24+
assertCodeParses(DOLLAR_TOKEN_AS_VAR_NAME);
2425
}
2526

2627
public function assertCodeParses(code:String, ?pos:PosInfos) {
@@ -158,4 +159,11 @@ abstract TokenTreeBuilderParsingTests(String) to String {
158159
}
159160
}";
160161

162+
var DOLLAR_TOKEN_AS_VAR_NAME = "
163+
class Test {
164+
function foo() {
165+
macro var $componentVarName = new $typePath();
166+
}
167+
}";
168+
161169
}

0 commit comments

Comments
 (0)