diff --git a/src/Assigning/Assignment.hs b/src/Assigning/Assignment.hs index 8c845f922..676b9af40 100644 --- a/src/Assigning/Assignment.hs +++ b/src/Assigning/Assignment.hs @@ -147,8 +147,10 @@ location = tracing Location `Then` return getRubyLocals :: HasCallStack => Assignment ast grammar [ByteString] getRubyLocals = tracing GetRubyLocals `Then` return -putRubyLocals :: HasCallStack => [ByteString] -> Assignment ast grammar () -putRubyLocals l = tracing (PutRubyLocals l) `Then` return +putRubyLocals :: (HasCallStack, Enum grammar, Eq1 ast, Ix grammar) => [ByteString] -> Assignment ast grammar () +putRubyLocals l = mk (PutRubyLocals l) <|> mk End + where + mk a = tracing a `Then` return -- | Zero-width production of the current node. currentNode :: HasCallStack => Assignment ast grammar (TermF ast (Node grammar) ()) diff --git a/src/Language/Ruby/Assignment.hs b/src/Language/Ruby/Assignment.hs index 0203cb119..729616a4e 100644 --- a/src/Language/Ruby/Assignment.hs +++ b/src/Language/Ruby/Assignment.hs @@ -147,14 +147,14 @@ expressions = makeTerm'' <$> location <*> many expression parenthesizedExpressions :: Assignment parenthesizedExpressions = makeTerm'' <$> symbol ParenthesizedStatements <*> children (Syntax.Paren <$> expressions) -withExtendedScope :: Assignment.Assignment ast grammar a -> Assignment.Assignment ast grammar a +withExtendedScope :: (Enum grammar, Ix grammar, Eq1 ast) => Assignment.Assignment ast grammar a -> Assignment.Assignment ast grammar a withExtendedScope inner = do locals <- getRubyLocals result <- inner putRubyLocals locals pure result -withNewScope :: Assignment.Assignment ast grammar a -> Assignment.Assignment ast grammar a +withNewScope :: (Enum grammar, Ix grammar, Eq1 ast) => Assignment.Assignment ast grammar a -> Assignment.Assignment ast grammar a withNewScope inner = withExtendedScope $ do putRubyLocals [] inner