1
1
mirror of https://github.com/github/semantic.git synced 2024-12-14 17:31:48 +03:00

Eval params to names in Evaluatable Function

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
This commit is contained in:
joshvera 2018-11-26 19:54:28 -05:00
parent af0184a195
commit e9a999b69e

View File

@ -29,15 +29,12 @@ instance Show1 Function where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Function where
eval _ Function{..} = do
name <- maybeM (throwEvalError NoNameError) (declaredName functionName)
-- TODO: We need a way to get the Span of the functionName that doesn't require
-- us to evaluate the term. If we evaluate the functionName here, we throw a
-- lookupPathError because we haven't declared it yet, but we can't declare
-- it without the Span of the term representing the functionName.
-- _ <- eval functionName
-- TODO: Should we declare the name of the function within `function`?
span <- ask @Span
declare (Declaration name) span Nothing
function name functionParameters functionBody
params <- for functionParameters $ \param -> do
maybeM (throwEvalError NoNameError) (declaredName param)
function name params functionBody
instance Tokenize Function where
tokenize Function{..} = within' Scope.Function $ do