2022-01-09 01:50:48 +03:00
|
|
|
module Analyzer.TestUtil where
|
|
|
|
|
|
|
|
import qualified Wasp.Analyzer.Parser as P
|
|
|
|
import qualified Wasp.Analyzer.TypeChecker as T
|
|
|
|
|
|
|
|
pos :: Int -> Int -> P.SourcePosition
|
|
|
|
pos line column = P.SourcePosition line column
|
|
|
|
|
2022-08-11 19:26:12 +03:00
|
|
|
rgn :: (Int, Int) -> (Int, Int) -> P.SourceRegion
|
|
|
|
rgn (sl, sc) (el, ec) = P.SourceRegion (pos sl sc) (pos el ec)
|
|
|
|
|
2022-01-09 01:55:52 +03:00
|
|
|
ctx :: (Int, Int) -> (Int, Int) -> P.Ctx
|
|
|
|
ctx (a, b) (c, d) = P.ctxFromRgn (pos a b) (pos c d)
|
2022-01-09 01:50:48 +03:00
|
|
|
|
2022-01-09 01:55:52 +03:00
|
|
|
wctx :: (Int, Int) -> (Int, Int) -> a -> P.WithCtx a
|
|
|
|
wctx start end = P.WithCtx (ctx start end)
|
2022-01-09 01:50:48 +03:00
|
|
|
|
|
|
|
fromWithCtx :: P.WithCtx T.TypedExpr -> T.TypedExpr
|
|
|
|
fromWithCtx = P.fromWithCtx
|