File tree Expand file tree Collapse file tree
src/Language/PureScript/CodeGen/JS Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ * Accommodate internally-generated identifiers that start with digits
Original file line number Diff line number Diff line change @@ -19,9 +19,12 @@ moduleNameToJs (ModuleName mn) =
1919--
2020-- * Alphanumeric characters are kept unmodified.
2121--
22- -- * Reserved javascript identifiers are prefixed with '$$'.
22+ -- * Reserved javascript identifiers and identifiers starting with digits are
23+ -- prefixed with '$$'.
2324identToJs :: Ident -> Text
24- identToJs (Ident name) = anyNameToJs name
25+ identToJs (Ident name)
26+ | not (T. null name) && isDigit (T. head name) = " $$" <> T. concatMap identCharToText name
27+ | otherwise = anyNameToJs name
2528identToJs (GenIdent _ _) = internalError " GenIdent in identToJs"
2629identToJs UnusedIdent = unusedIdent
2730identToJs (InternalIdent RuntimeLazyFactory ) = " $runtime_lazy"
Original file line number Diff line number Diff line change 1+ module Main where
2+
3+ import Data.Symbol (class IsSymbol , reflectSymbol )
4+ import Effect.Console (log )
5+ import Type.Proxy (Proxy (..))
6+
7+ reflectSymbol' :: forall s . IsSymbol s => Proxy s -> String
8+ reflectSymbol' = reflectSymbol
9+
10+ two = reflectSymbol (Proxy :: _ " 2" )
11+ two2 = reflectSymbol' (Proxy :: _ " 2" )
12+
13+ twoThirty = reflectSymbol (Proxy :: _ " 2:30" )
14+ twoThirty2 = reflectSymbol' (Proxy :: _ " 2:30" )
15+
16+ main = log " Done"
You can’t perform that action at this time.
0 commit comments