Skip to content

Commit 37a5366

Browse files
committed
stage1: replace $ in JS names with _
1 parent bb1ebca commit 37a5366

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

stage1/main.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ std::string CppifyName(ts::Symbol jsymSymbol) noexcept {
3939
tc::for_each(
4040
tc::transform(strSourceName, [&](char c) noexcept {
4141
if ('-' == c) return '_';
42+
if ('$' == c) return '_';
4243
if ('_' == c) return c;
4344
if ('a' <= c && c <= 'z') return c;
4445
if ('A' <= c && c <= 'Z') return c;

stage1/tests/compile-module/MyLib.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ declare namespace Foo {
8282
class ClassWithDefaultConstructor {
8383
a: ConstructibleClass;
8484
}
85+
86+
class WeirdNames {
87+
default: number;
88+
"$foo": number;
89+
}
8590
}
8691

8792
export = Foo;

0 commit comments

Comments
 (0)