on master help sign in
Code cleanup
43ab5e1jmite
src/Canonicalize/Setup.hs+5−8
@@ -282,20 +282,17 @@ declarationsToPatches moduleName decls =
282 (Maybe.catMaybes maybeNodes, concat patchLists)
282 (Maybe.catMaybes maybeNodes, concat patchLists)
283
283
284
284
285−-- When canonicalizing, all _values should be Local, except for top-level definitions but all
285+-- When canonicalizing, all _values should be Local, except for top-level definitions
286−-- For _adts and _patterns,
286+-- However _adts and _patterns
287−-- we assume constructors are top-evel
287+-- should be fully namespaced, thought constructors are top_level.
288−-- should be fully namespaced. With _adts, they may appear in types that can
288+-- With _adts, they may appear in types that can
289-- escape the module.
289-- escape the module.
290declToPatches
290declToPatches
291 :: Module.Name
291 :: Module.Name
292 -> D.ValidDecl
292 -> D.ValidDecl
293 -> (Maybe Node, [Env.Patch])
293 -> (Maybe Node, [Env.Patch])
294declToPatches moduleName (A.A (region,_) decl) =
294declToPatches moduleName (A.A (region,_) decl) =
295− let --local mkPatch x =
296− -- mkPatch x (Var.local x)
297−
298− topLevel mkPatch x =
295+ let topLevel mkPatch x =
299 mkPatch x (Var.topLevel moduleName x )
296 mkPatch x (Var.topLevel moduleName x )
300
297
301 namespaced mkPatch x =
298 namespaced mkPatch x =
src/Canonicalize/Variable.hs+1−1
@@ -145,7 +145,7 @@ preferLocals' region env extract kind possibilities var =
145 ambiguous possibleVars =
145 ambiguous possibleVars =
146 Result.err (A.A region (Error.variable kind var Error.Ambiguous vars))
146 Result.err (A.A region (Error.variable kind var Error.Ambiguous vars))
147 where
147 where
148− vars = map (show {-Var.toString-} . extract) possibleVars
148+ vars = map (Var.toString . extract) possibleVars
149
149
150
150
151-- NOT FOUND HELPERS
151-- NOT FOUND HELPERS
src/Generate/JavaScript/Variable.hs−1
@@ -23,7 +23,6 @@ canonical (Var.Canonical home name) =
23 home' =
23 home' =
24 case home of
24 case home of
25 Var.Local -> []
25 Var.Local -> []
26− --TODO: change this to act like Module
27 Var.TopLevel _ -> []
26 Var.TopLevel _ -> []
28 Var.BuiltIn -> []
27 Var.BuiltIn -> []
29 Var.Module path -> [ moduleName path ]
28 Var.Module path -> [ moduleName path ]