on master help sign in
Make sure that variables generated during parsing are less likely to overlap. This is not a pretty fix, but it is better than the previous system.
commit50ddf4cddcf6681e6bb60c1a8482ef8074c5c7ca authorevancz <info@elm-lang.org> dateSat 9 Feb 2013, 13:02 (14 years ago) parent6d8a50d
2 files changed+7−4
elm/src/Guid.hs+3−2 elm/src/Parse/Expr.hs+4−2
elm/src/Guid.hs+3−2
@@ -1,5 +1,5 @@
11{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2−module Guid (guid, run, GuidCounter) where
2+module Guid (guid, run, runAt, GuidCounter) where
33
44import Control.Monad.State (evalState, State, get, put)
55
@@ -13,4 +13,5 @@ guid = GC $ do n <- get
1313 put (n + 1)
1414 return n
1515
16−run x = evalState (runGC x) 0
16+run = runAt 0
17+runAt n x = evalState (runGC x) n
elm/src/Parse/Expr.hs+4−2
@@ -98,7 +98,8 @@ recordTerm = brackets $ choice [ misc, addContext record ]
9898 fDefs <- (:) <$> (PVar <$> rLabel) <*> spacePrefix patternTerm
9999 whitespace
100100 e <- string "=" >> whitespace >> expr
101− run $ flattenPatterns fDefs e
101+ n <- sourceLine <$> getPosition
102+ runAt (1000 * n) $ flattenPatterns fDefs e
102103 extract [ FnDef f args exp ] = return (f,args,exp)
103104 extract _ = fail "Improperly formed record field."
104105 record = Record <$> (mapM extract =<< commaSep field)
@@ -203,7 +204,8 @@ assignExpr = withPos $ do
203204 fDefs <- funcDef
204205 whitespace
205206 e <- string "=" >> whitespace >> expr
206− run $ flattenPatterns fDefs e
207+ n <- sourceLine <$> getPosition
208+ runAt (1000 * n) $ flattenPatterns fDefs e
207209
208210def = map Definition <$> assignExpr
209211