Improved the visibility checkup a little bit.
This commit is contained in:
parent
91816abfe6
commit
ae34c494f5
1 changed files with 4 additions and 3 deletions
|
|
@ -15,6 +15,7 @@ import qualified Data.Bifunctor as BI
|
||||||
import Data.List.Extra (trim)
|
import Data.List.Extra (trim)
|
||||||
import Data.Map (Map)
|
import Data.Map (Map)
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
|
import Data.Maybe (fromMaybe)
|
||||||
import Data.Tuple.Extra (dupe, first, second)
|
import Data.Tuple.Extra (dupe, first, second)
|
||||||
import qualified Grammar.Abs as GA
|
import qualified Grammar.Abs as GA
|
||||||
import Grammar.ErrM (Err)
|
import Grammar.ErrM (Err)
|
||||||
|
|
@ -311,10 +312,10 @@ emitApp t e1 e2 = appEmitter t e1 e2 []
|
||||||
vs <- getNewVar
|
vs <- getNewVar
|
||||||
funcs <- gets functions
|
funcs <- gets functions
|
||||||
consts <- gets constructors
|
consts <- gets constructors
|
||||||
let visibility = maybe Local (const Global) $
|
let visibility = fromMaybe Local $
|
||||||
const Global <$ Map.lookup id consts
|
Global <$ Map.lookup id consts
|
||||||
<|>
|
<|>
|
||||||
const Global <$ Map.lookup id funcs
|
Global <$ Map.lookup id funcs
|
||||||
-- this piece of code could probably be improved, i.e remove the double `const Global`
|
-- this piece of code could probably be improved, i.e remove the double `const Global`
|
||||||
args' = map (first valueGetType . dupe) args
|
args' = map (first valueGetType . dupe) args
|
||||||
call = Call FastCC (type2LlvmType t) visibility (GA.Ident name) args'
|
call = Call FastCC (type2LlvmType t) visibility (GA.Ident name) args'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue