summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlexander Ivanov <alehander42@gmail.com>2020-04-03 21:22:03 +0300
committerGitHub <noreply@github.com>2020-04-03 20:22:03 +0200
commitcec320b56938cac42c2457dd4d362419b554d456 (patch)
treeeadffee547f84daf0fb227dcafb5ccd3a8e01590
parent920add5880e74695025d2383dd6806c51bd831b5 (diff)
downloadNim-cec320b56938cac42c2457dd4d362419b554d456.tar.gz
Remove my wrongly written mangled-related code, not needed anymore (#13858)
-rw-r--r--compiler/jsgen.nim9
-rw-r--r--compiler/sourcemap.nim6
2 files changed, 4 insertions, 11 deletions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim
index c41f89a88..eabc8306d 100644
--- a/compiler/jsgen.nim
+++ b/compiler/jsgen.nim
@@ -205,8 +205,6 @@ proc mapType(typ: PType): TJSTypeKind =
 proc mapType(p: PProc; typ: PType): TJSTypeKind =
   result = mapType(typ)
 
-var mangled = initSet[string]()
-
 proc mangleName(m: BModule, s: PSym): Rope =
   proc validJsName(name: string): bool =
     result = true
@@ -261,11 +259,6 @@ proc mangleName(m: BModule, s: PSym): Rope =
         result.add(rope(s.id))
     s.loc.r = result
 
-  # TODO: optimize
-  let s = $result
-  if '_' in s:
-    mangled.incl(s)
-
 proc escapeJSString(s: string): string =
   result = newStringOfCap(s.len + s.len shr 2)
   result.add("\"")
@@ -2609,7 +2602,7 @@ proc myClose(graph: ModuleGraph; b: PPassContext, n: PNode): PNode =
 
     if optSourcemap in m.config.globalOptions:
       var map: SourceMap
-      (code, map) = genSourceMap($(code), mangled, outFile.string)
+      (code, map) = genSourceMap($(code), outFile.string)
       writeFile(outFile.string & ".map", $(%map))
     discard writeRopeIfNotEqual(code, outFile)
     
diff --git a/compiler/sourcemap.nim b/compiler/sourcemap.nim
index 1aa294371..90e34eb73 100644
--- a/compiler/sourcemap.nim
+++ b/compiler/sourcemap.nim
@@ -158,7 +158,7 @@ iterator tokenize*(line: string): (bool, string) =
   if token.len > 0:
     yield (isMangled, token)
 
-proc parse*(source: string, path: string, mangled: HashSet[string]): SourceNode =
+proc parse*(source: string, path: string): SourceNode =
   let lines = source.splitLines()
   var lastLocation: SourceNode = nil
   result = newSourceNode(0, 0, path, @[])
@@ -378,8 +378,8 @@ proc toSourceMap*(node: SourceNode, file: string): SourceMapGenerator =
   map
 
 
-proc genSourceMap*(source: string, mangled: HashSet[string], outFile: string): (Rope, SourceMap) =
-  let node = parse(source, outFile, mangled)
+proc genSourceMap*(source: string, outFile: string): (Rope, SourceMap) =
+  let node = parse(source, outFile)
   let map = node.toSourceMap(file = outFile)
   ((&"{source}\n//# sourceMappingURL={outFile}.map").rope, map.gen)