Skip to content

Commit e9d3937

Browse files
committed
Rebase to v2
1 parent 8b59d45 commit e9d3937

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/Targets/ReScript/ReScriptHelper.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ module Attr =
9797

9898
module Naming =
9999
let removeInvalidChars (s: string) =
100-
s.ToCharArray()
100+
s.Trim('"').ToCharArray()
101101
|> Array.map (fun c -> if Char.isAlphabetOrDigit c || c = '_' || c = '\'' then c else '_')
102102
|> System.String
103103

src/Targets/ReScript/Writer.fs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,23 +1556,23 @@ let createStructuredText (rootCtx: Context) (stmts: Statement list) : Structured
15561556
let addAnonymousInterfaceExcluding ais current = addAnonymousInterfaceExcludingWithKnownTypes (knownTypes ()) ais current
15571557

15581558
match s with
1559-
| Module m ->
1559+
| Namespace m ->
15601560
let module' =
1561-
let scope =
1562-
if m.isNamespace then Scope.Default
1563-
else Scope.Module m.name
1564-
let node = {| StructuredTextNode.empty with comments = comments; scope = scope |}
1561+
let node = {| StructuredTextNode.empty with comments = comments; scope = Scope.Default |}
15651562
let module' = current |> getTrie [m.name] |> set node
15661563
let ctx = ctx |> Context.ofChildNamespace m.name
15671564
m.statements |> List.fold (folder ctx) module'
15681565
let current = current |> setTrie [m.name] module'
15691566
match module'.value with
15701567
| None -> current
1571-
| Some _ ->
1572-
let kind =
1573-
if m.isNamespace then Kind.OfNamespace
1574-
else Kind.OfModule
1575-
current |> addExport m.name kind (if m.isNamespace then "namespace" else "module")
1568+
| Some _ -> current |> addExport m.name Kind.OfNamespace "namespace"
1569+
| AmbientModule m ->
1570+
let module' =
1571+
let node = {| StructuredTextNode.empty with comments = comments; scope = Scope.Module m.name.unquoted |}
1572+
let module' = current |> getTrie [m.name.orig] |> set node
1573+
let ctx = ctx |> Context.ofChildNamespace m.name.orig
1574+
m.statements |> List.fold (folder ctx) module'
1575+
current |> setTrie [m.name.orig] module'
15761576
| Global m ->
15771577
current |> inTrie ["global"] (fun g ->
15781578
let node = {| StructuredTextNode.empty with scope = Scope.Global |}

0 commit comments

Comments
 (0)