From 41571696628b6c65ab07ff760d9e636f4ccccd91 Mon Sep 17 00:00:00 2001 From: Griffin Date: Tue, 27 Aug 2024 00:15:51 +0800 Subject: [PATCH] chore: fix typo (#7) --- src/Lib/AST/Stat.hs | 8 ++++---- src/Lib/Command.hs | 7 ++++++- tests/Lib/AST/StatSpec.hs | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Lib/AST/Stat.hs b/src/Lib/AST/Stat.hs index 614efcb..b434cf8 100644 --- a/src/Lib/AST/Stat.hs +++ b/src/Lib/AST/Stat.hs @@ -4,7 +4,7 @@ module Lib.AST.Stat ( pState, pStateVariable, pEmitStatement, - pCatchStatment, + pCatchStatement, pTryStatement, pDoWhileStatement, pWhileStatement, @@ -385,7 +385,7 @@ pTryStatement = do (pManySpaces >> pOneKeyword leftCurlyBrace >> pManySpaces) (pManySpaces >> pOneKeyword rightCurlyBrace >> pManySpaces) (many pState) - catches <- many pCatchStatment + catches <- many pCatchStatement return TryStatement { tryExpr = expr, @@ -394,8 +394,8 @@ pTryStatement = do tryCatches = catches } -pCatchStatment :: Parser CatchStatement -pCatchStatment = do +pCatchStatement :: Parser CatchStatement +pCatchStatement = do ident <- pOneKeyword "catch" >> pMany1Spaces diff --git a/src/Lib/Command.hs b/src/Lib/Command.hs index e4adaef..b10e64e 100644 --- a/src/Lib/Command.hs +++ b/src/Lib/Command.hs @@ -5,7 +5,7 @@ module Lib.Command (executeFile, executeProject) where import Data.Text (Text, pack, unpack) import Lib.AST.File (pWholeSolFile) -import Lib.AST.Model (ContractDefinition (contractName), SolFile (SolFile, solContracts, solFunctions)) +import Lib.AST.Model (ContractDefinition (contractName), SolFile (SolFile, solContracts, solFunctions), FunctionDefinition (..)) import Lib.AST.Parser (runSParser) import System.Directory (canonicalizePath, doesDirectoryExist, doesFileExist) import System.Directory.Internal.Prelude (exitFailure) @@ -41,3 +41,8 @@ executeProject folderPath = do checkFile :: SolFile -> IO () checkFile SolFile {..} = do foldMap (\c -> putStr "contract definition: " >> (print . contractName) c) solContracts + +checkFunction :: FunctionDefinition -> Maybe Text +checkFunction FunctionDefinition{..} = do + return "" + diff --git a/tests/Lib/AST/StatSpec.hs b/tests/Lib/AST/StatSpec.hs index 26f9e4d..a9482b3 100644 --- a/tests/Lib/AST/StatSpec.hs +++ b/tests/Lib/AST/StatSpec.hs @@ -801,7 +801,7 @@ parseCatchStatementSpec = do "" ) ] - forM_ testCases $ exactlyParserVerifier "catch statement only" pCatchStatment + forM_ testCases $ exactlyParserVerifier "catch statement only" pCatchStatement parseEmitStatementSpec :: Spec parseEmitStatementSpec = do