assignTerm ::
  SharedContext      {- ^ context for constructing SAW terms    -} ->
  JVMCrucibleContext    {- ^ context for interacting with Crucible -} ->
  W4.ProgramLoc ->
  PrePost                                                          ->
  VarIndex {- ^ external constant index -} ->
  Term     {- ^ value                   -} ->
  OverrideMatcher CJ.JVM w ()

assignTerm sc cc loc prepost var val =
  do mb <- OM (use (termSub . at var))
     case mb of
       Nothing -> OM (termSub . at var ?= val)
       Just old ->
         matchTerm sc cc loc prepost val old


------------------------------------------------------------------------

-- | Match the value of a function argument with a symbolic 'SetupValue'.
assignTerm ::
  SharedContext      {- ^ context for constructing SAW terms    -} ->
  JVMCrucibleContext    {- ^ context for interacting with Crucible -} ->
  W4.ProgramLoc ->
  PrePost                                                          ->
  VarIndex {- ^ external constant index -} ->
  Term     {- ^ value                   -} ->
  OverrideMatcher CJ.JVM w ()
assignTerm sc cc loc prepost var val =
  do mb <- OM (use (termSub . at var))
     case mb of
       Nothing -> OM (termSub . at var ?= val)
       Just old ->
         matchTerm sc cc loc prepost val old


------------------------------------------------------------------------

-- | Match the value of a function argument with a symbolic 'SetupValue'.
assignTerm sc cc loc prepost var val =
  do mb <- OM (use (termSub . at var))
     case mb of
       Nothing -> OM (termSub . at var ?= val)
       Just old ->
         matchTerm sc cc loc prepost val old


------------------------------------------------------------------------

-- | Match the value of a function argument with a symbolic 'SetupValue'.