Skip to content

Commit

Permalink
Merging unknown and other semantics
Browse files Browse the repository at this point in the history
Fixes #167
  • Loading branch information
flbulgarelli committed May 3, 2018
1 parent 53d9dc9 commit b26c8b8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion spec/InspectorSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ spec = do

it "is False otherwise" $ do
assigns (named "x") (Assignment "y" (MuTrue)) `shouldBe` False
assigns (named "x") (Other) `shouldBe` False
assigns (named "x") (Other Nothing Nothing) `shouldBe` False
assigns (named "x") (MuFalse) `shouldBe` False

describe "declaresFunction" $ do
Expand Down
9 changes: 2 additions & 7 deletions src/Language/Mulang/Ast.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ module Language.Mulang.Ast (
debug,
debugType,
debugPattern,
pattern Other,
pattern OtherBody,
pattern SimpleEquation,
pattern SimpleFunction,
pattern SimpleProcedure,
Expand Down Expand Up @@ -166,7 +164,7 @@ data Expression
-- ^ Imperative / OOP programming c-style for loop
| Sequence [Expression]
-- ^ Generic sequence of statements
| Unknown (Maybe String) (Maybe Expression)
| Other (Maybe String) (Maybe Expression)
-- ^ Unrecognized expression, with optional description and body
| Equal
| NotEqual
Expand Down Expand Up @@ -222,7 +220,7 @@ data Statement
deriving (Eq, Show, Read, Generic)

debug :: Show a => a -> Expression
debug a = Unknown (Just (show a)) Nothing
debug a = Other (Just (show a)) Nothing

debugType :: Show a => a -> Type
debugType a = OtherType (Just (show a)) Nothing
Expand All @@ -234,9 +232,6 @@ pattern VariableSignature name t cs = TypeSignature name (SimpleType t cs
pattern SubroutineSignature name args t cs = TypeSignature name (ParameterizedType args t cs)
pattern ModuleSignature name cs = TypeSignature name (ConstrainedType cs)

pattern Other = Unknown Nothing Nothing
pattern OtherBody body <- Unknown _ (Just body)

pattern SimpleEquation params body = Equation params (UnguardedBody body)

pattern SimpleSend receptor selector args = Send receptor (Reference selector) args
Expand Down
2 changes: 1 addition & 1 deletion src/Language/Mulang/Generator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ expressions expr = expr : concatMap expressions (subExpressions expr)
subExpressions (New _ es) = es
subExpressions (Not e) = [e]
subExpressions (Object _ v) = [v]
subExpressions (OtherBody e) = [e]
subExpressions (Other _ (Just e)) = [e]
subExpressions (Repeat e1 e2) = [e1, e2]
subExpressions (Return v) = [v]
subExpressions (Sequence es) = es
Expand Down

0 comments on commit b26c8b8

Please sign in to comment.