@@ -96,13 +96,15 @@ data BuiltinFunctionId
9696instance Hashable BuiltinFunctionId
9797
9898data CompilerOptions = CompilerOptions
99- { _compilerOptionsNoStdlib :: Bool
99+ { _compilerOptionsNoStdlib :: Bool ,
100+ _compilerOptionsNoImportDecoding :: Bool
100101 }
101102
102103fromEntryPoint :: EntryPoint -> CompilerOptions
103104fromEntryPoint EntryPoint {.. } =
104105 CompilerOptions
105- { _compilerOptionsNoStdlib = _entryPointNoAnomaStdlib
106+ { _compilerOptionsNoStdlib = _entryPointNoAnomaStdlib,
107+ _compilerOptionsNoImportDecoding = _entryPointNoNockImportDecoding
106108 }
107109
108110newtype FunctionCtx = FunctionCtx
@@ -129,6 +131,7 @@ data CompilerCtx = CompilerCtx
129131 _compilerModuleInfos :: HashMap ModuleId ModuleInfo ,
130132 _compilerModuleId :: ModuleId ,
131133 _compilerBatch :: Bool ,
134+ _compilerNoImportDecoding :: Bool ,
132135 -- | Maps temporary variables to their stack indices.
133136 _compilerTempVarMap :: HashMap Int TempRef ,
134137 _compilerTempVarsNum :: Int ,
@@ -149,6 +152,7 @@ emptyCompilerCtx =
149152 _compilerModuleInfos = mempty ,
150153 _compilerModuleId = defaultModuleId,
151154 _compilerBatch = True ,
155+ _compilerNoImportDecoding = False ,
152156 _compilerTempVarMap = mempty ,
153157 _compilerTempVarsNum = 0 ,
154158 _compilerStackHeight = 0
@@ -321,7 +325,11 @@ mkScry :: [Term Natural] -> Term Natural
321325mkScry key = OpScry # (OpQuote # nockNilTagged " OpScry-typehint" ) # (foldTermsOrQuotedNil key)
322326
323327mkScryDecode :: (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]
325333
326334allConstructors :: Tree. Module -> Tree. ConstructorInfo -> NonEmpty Tree. ConstructorInfo
327335allConstructors md ci =
@@ -468,11 +476,12 @@ compileToSubject bundleAnomaLib ctx importsSHA256 importedModuleIds userFuns msy
468476fromTreeModule :: (Member (Reader CompilerOptions ) r ) => (ModuleId -> Sem r Module ) -> InfoTable -> Tree. Module -> Sem r Module
469477fromTreeModule fetchModule importsTab md = do
470478 optNoStdlib <- asks (^. compilerOptionsNoStdlib)
479+ optNoImportDecoding <- asks (^. compilerOptionsNoImportDecoding)
471480 importsSHA256 :: HashMap ModuleId ByteString <-
472481 HashMap. fromList
473482 . map (\ m -> (m ^. moduleId, fromJust (m ^. moduleInfoTable . infoSHA256)))
474483 <$> 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)
476485 jammedCode = jamToByteString moduleCode
477486 tab =
478487 InfoTable
@@ -529,8 +538,8 @@ fromTreeModule fetchModule importsTab md = do
529538 }
530539 )
531540
532- compilerCtx :: CompilerCtx
533- compilerCtx =
541+ compilerCtx :: Bool -> CompilerCtx
542+ compilerCtx optNoImportDecoding =
534543 emptyCompilerCtx
535544 { _compilerFunctionInfos =
536545 userFunInfos <> importsTab ^. infoFunctions,
@@ -539,7 +548,8 @@ fromTreeModule fetchModule importsTab md = do
539548 _compilerModuleInfos =
540549 HashMap. fromList $ map mkModuleInfo [0 .. length allModuleIds - 1 ],
541550 _compilerModuleId = md ^. Tree. moduleId,
542- _compilerBatch = null importedFuns
551+ _compilerBatch = null importedFuns,
552+ _compilerNoImportDecoding = optNoImportDecoding
543553 }
544554 where
545555 mkModuleInfo :: Int -> (ModuleId , ModuleInfo )
0 commit comments