@@ -130,6 +130,7 @@ import Swarm.Game.Tick (addTicks)
130130import Swarm.Game.Universe as U
131131import Swarm.Game.World qualified as W
132132import Swarm.Game.World.Coords
133+ import Swarm.Language.Load (SyntaxWithImports (.. ))
133134import Swarm.Language.Pipeline (processSource , requireNonEmptyTerm )
134135import Swarm.Language.Syntax (Phase (.. ), SrcLoc (.. ), Syntax , sLoc )
135136import Swarm.Language.Value (Env )
@@ -149,7 +150,7 @@ data SolutionSource
149150
150151data CodeToRun = CodeToRun
151152 { _toRunSource :: SolutionSource
152- , _toRunSyntax :: Syntax Elaborated
153+ , _toRunSyntax :: SyntaxWithImports Elaborated
153154 }
154155
155156makeLenses ''CodeToRun
@@ -166,8 +167,8 @@ parseCodeFile ::
166167parseCodeFile filepath = do
167168 contents <- sendIO $ TIO. readFile filepath
168169 mpt <- sendIO . runError $ requireNonEmptyTerm =<< processSource contents Nothing
169- pt <- either (throwError @ SystemFailure ) ( pure . snd ) mpt -- XXX need SourceMap?
170- let srcLoc = pt ^. sLoc
170+ pt <- either (throwError @ SystemFailure ) pure mpt
171+ let srcLoc = getSyntax pt ^. sLoc
171172 strippedText = stripSrc srcLoc contents
172173 programBytestring = TL. encodeUtf8 $ TL. fromStrict strippedText
173174 sha1Hash = showDigest $ sha1 programBytestring
@@ -204,7 +205,7 @@ data GameState = GameState
204205 { _creativeMode :: Bool
205206 , _temporal :: TemporalState
206207 , _winCondition :: WinCondition Elaborated
207- , _winSolution :: Maybe (Syntax Elaborated )
208+ , _winSolution :: Maybe (SyntaxWithImports Elaborated )
208209 , _robotInfo :: Robots
209210 , _pathCaching :: PathCaching
210211 , _discovery :: Discovery
@@ -236,7 +237,7 @@ winCondition :: Lens' GameState (WinCondition Elaborated)
236237
237238-- | How to win (if possible). This is useful for automated testing
238239-- and to show help to cheaters (or testers).
239- winSolution :: Lens' GameState (Maybe (Syntax Elaborated ))
240+ winSolution :: Lens' GameState (Maybe (SyntaxWithImports Elaborated ))
240241
241242-- | Get a list of all the robots at a particular location.
242243robotsAtLocation :: Cosmic Location -> GameState -> [Robot Instantiated ]
0 commit comments