module Tokstyle.Analysis.Context
    ( pushContext
    , kLimit
    ) where

import           Tokstyle.Analysis.Types (Context, NodeId)

-- | Adds a new call site to a context, respecting the k-limit.
-- Prepends the new node ID and then takes the first k elements.
pushContext :: Int -> NodeId -> Context -> Context
pushContext :: Int -> Int -> Context -> Context
pushContext Int
k Int
nodeId Context
context = Int -> Context -> Context
forall a. Int -> [a] -> [a]
take Int
k (Int
nodeId Int -> Context -> Context
forall a. a -> [a] -> [a]
: Context
context)

kLimit :: Int
kLimit :: Int
kLimit = Int
2