@@ -96,13 +96,15 @@ data BuiltinFunctionId
96
96
instance Hashable BuiltinFunctionId
97
97
98
98
data CompilerOptions = CompilerOptions
99
- { _compilerOptionsNoStdlib :: Bool
99
+ { _compilerOptionsNoStdlib :: Bool ,
100
+ _compilerOptionsNoImportDecoding :: Bool
100
101
}
101
102
102
103
fromEntryPoint :: EntryPoint -> CompilerOptions
103
104
fromEntryPoint EntryPoint {.. } =
104
105
CompilerOptions
105
- { _compilerOptionsNoStdlib = _entryPointNoAnomaStdlib
106
+ { _compilerOptionsNoStdlib = _entryPointNoAnomaStdlib,
107
+ _compilerOptionsNoImportDecoding = _entryPointNoNockImportDecoding
106
108
}
107
109
108
110
newtype FunctionCtx = FunctionCtx
@@ -129,6 +131,7 @@ data CompilerCtx = CompilerCtx
129
131
_compilerModuleInfos :: HashMap ModuleId ModuleInfo ,
130
132
_compilerModuleId :: ModuleId ,
131
133
_compilerBatch :: Bool ,
134
+ _compilerNoImportDecoding :: Bool ,
132
135
-- | Maps temporary variables to their stack indices.
133
136
_compilerTempVarMap :: HashMap Int TempRef ,
134
137
_compilerTempVarsNum :: Int ,
@@ -149,6 +152,7 @@ emptyCompilerCtx =
149
152
_compilerModuleInfos = mempty ,
150
153
_compilerModuleId = defaultModuleId,
151
154
_compilerBatch = True ,
155
+ _compilerNoImportDecoding = False ,
152
156
_compilerTempVarMap = mempty ,
153
157
_compilerTempVarsNum = 0 ,
154
158
_compilerStackHeight = 0
@@ -321,7 +325,11 @@ mkScry :: [Term Natural] -> Term Natural
321
325
mkScry key = OpScry # (OpQuote # nockNilTagged " OpScry-typehint" ) # (foldTermsOrQuotedNil key)
322
326
323
327
mkScryDecode :: (Member (Reader CompilerCtx ) r ) => [Term Natural ] -> Sem r (Term Natural )
324
- mkScryDecode key = callStdlib StdlibDecode [mkScry key]
328
+ mkScryDecode key = do
329
+ bNoDecode <- asks (^. compilerNoImportDecoding)
330
+ if
331
+ | bNoDecode -> return $ mkScry key
332
+ | otherwise -> callStdlib StdlibDecode [mkScry key]
325
333
326
334
allConstructors :: Tree. Module -> Tree. ConstructorInfo -> NonEmpty Tree. ConstructorInfo
327
335
allConstructors md ci =
@@ -468,11 +476,12 @@ compileToSubject bundleAnomaLib ctx importsSHA256 importedModuleIds userFuns msy
468
476
fromTreeModule :: (Member (Reader CompilerOptions ) r ) => (ModuleId -> Sem r Module ) -> InfoTable -> Tree. Module -> Sem r Module
469
477
fromTreeModule fetchModule importsTab md = do
470
478
optNoStdlib <- asks (^. compilerOptionsNoStdlib)
479
+ optNoImportDecoding <- asks (^. compilerOptionsNoImportDecoding)
471
480
importsSHA256 :: HashMap ModuleId ByteString <-
472
481
HashMap. fromList
473
482
. map (\ m -> (m ^. moduleId, fromJust (m ^. moduleInfoTable . infoSHA256)))
474
483
<$> mapM fetchModule importedModuleIds
475
- let moduleCode = compileToSubject (not optNoStdlib) compilerCtx importsSHA256 importedModuleIds userFuns (md ^. Tree. moduleInfoTable . Tree. infoMainFunction)
484
+ let moduleCode = compileToSubject (not optNoStdlib) ( compilerCtx optNoImportDecoding) importsSHA256 importedModuleIds userFuns (md ^. Tree. moduleInfoTable . Tree. infoMainFunction)
476
485
jammedCode = jamToByteString moduleCode
477
486
tab =
478
487
InfoTable
@@ -529,8 +538,8 @@ fromTreeModule fetchModule importsTab md = do
529
538
}
530
539
)
531
540
532
- compilerCtx :: CompilerCtx
533
- compilerCtx =
541
+ compilerCtx :: Bool -> CompilerCtx
542
+ compilerCtx optNoImportDecoding =
534
543
emptyCompilerCtx
535
544
{ _compilerFunctionInfos =
536
545
userFunInfos <> importsTab ^. infoFunctions,
@@ -539,7 +548,8 @@ fromTreeModule fetchModule importsTab md = do
539
548
_compilerModuleInfos =
540
549
HashMap. fromList $ map mkModuleInfo [0 .. length allModuleIds - 1 ],
541
550
_compilerModuleId = md ^. Tree. moduleId,
542
- _compilerBatch = null importedFuns
551
+ _compilerBatch = null importedFuns,
552
+ _compilerNoImportDecoding = optNoImportDecoding
543
553
}
544
554
where
545
555
mkModuleInfo :: Int -> (ModuleId , ModuleInfo )
0 commit comments