diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-01-11 16:38:53 +0100 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-01-11 16:38:53 +0100 |
| commit | ad4528eaf7e65575e3fc91959e86f08d3bb5338d (patch) | |
| tree | fb404f0bd9bb1ee97ac26a002e8e075a5a15fcb4 /src/Script/Expr.hs | |
| parent | a699c3ddd443a2d6113fe3b08f7ae81c510239e6 (diff) | |
Do not show internal variables in call stack list
Diffstat (limited to 'src/Script/Expr.hs')
| -rw-r--r-- | src/Script/Expr.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Script/Expr.hs b/src/Script/Expr.hs index 1a0f458..bc4f9cb 100644 --- a/src/Script/Expr.hs +++ b/src/Script/Expr.hs @@ -133,6 +133,13 @@ withVar name value = withDictionary (( name, someConstValue value ) : ) withTypedVar :: (MonadEval m, ExprType e) => TypedVarName e -> e -> m a -> m a withTypedVar (TypedVarName name) = withVar name +isInternalVar :: FqVarName -> Bool +isInternalVar (GlobalVarName {}) = False +isInternalVar (LocalVarName (VarName name)) + | Just ( '$', _ ) <- T.uncons name = True + | otherwise = False + + newtype SimpleEval a = SimpleEval (ReaderT ( GlobalDefs, VariableDictionary ) (Except String) a) deriving (Functor, Applicative, Monad, MonadError String) @@ -401,12 +408,15 @@ gatherVars = fmap (uniqOn fst . sortOn fst) . helper Let _ (TypedVarName var) _ expr -> withDictionary (filter ((var /=) . fst)) $ helper expr Variable _ var | GlobalVarName {} <- var -> return [] + | isInternalVar var -> return [] | otherwise -> maybe [] (\x -> [ (( var, [] ), x ) ]) <$> tryLookupVar var DynVariable _ _ var | GlobalVarName {} <- var -> return [] + | isInternalVar var -> return [] | otherwise -> maybe [] (\x -> [ (( var, [] ), x ) ]) <$> tryLookupVar var FunVariable _ _ var | GlobalVarName {} <- var -> return [] + | isInternalVar var -> return [] | otherwise -> maybe [] (\x -> [ (( var, [] ), x ) ]) <$> tryLookupVar var ArgsReq args expr -> withDictionary (filter ((`notElem` map fst (toList args)) . fst)) $ helper expr ArgsApp (FunctionArguments args) fun -> do |