Skip to content

Commit

Permalink
BUG Revert earlier change to fix error checking
Browse files Browse the repository at this point in the history
The early error checking code is very simplistic and this broke some
common usage:

    a = ...
    ...
    write(..., ofile=a </> b)

would become

    a = ...
    ...
    t = a </> b
    write(..., ofile=t)

and now the check would not be bubbled past the `t = ...` assignment
  • Loading branch information
luispedro committed Jan 19, 2021
1 parent b1e39a5 commit 659a16d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion NGLess/Transform.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{- Copyright 2016-2020 NGLess Authors
{- Copyright 2016-2021 NGLess Authors
- License: MIT
-}
{-# LANGUAGE FlexibleContexts #-}
Expand Down Expand Up @@ -523,12 +523,17 @@ addTemporaries = addTemporaries' 0
put (n + 1)
tell [Assignment v e]
return (Lookup t v)
{- The code below seemed like a good idea, but breaks the early
- error checking (as it relies on a very simplistic way of
- "bubbling up" the error checking code:
-
functionCallTemp e@BinaryOp{} = do
n <- get
let v = Variable (T.pack $ "temp$"++show n)
put (n + 1)
tell [Assignment v e]
return (Lookup Nothing v)
-}
functionCallTemp e = return e

{-| Calculation of hashes for output method calls
Expand Down

0 comments on commit 659a16d

Please sign in to comment.