Import Decode by default in all modules

This commit is contained in:
Ayaz Hafiz 2022-09-21 10:49:29 -05:00
parent f10c47ec20
commit 06bef34829
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 81 additions and 57 deletions

View file

@ -124,6 +124,14 @@ const MODULE_ENCODE_TYPES: &[(&str, Symbol)] = &[
("EncoderFormatting", Symbol::ENCODE_ENCODERFORMATTING),
];
const MODULE_DECODE_TYPES: &[(&str, Symbol)] = &[
("DecodeError", Symbol::DECODE_DECODE_ERROR),
("DecodeResult", Symbol::DECODE_DECODE_RESULT),
("Decoder", Symbol::DECODE_DECODER_OPAQUE),
("Decoding", Symbol::DECODE_DECODING),
("DecoderFormatting", Symbol::DECODE_DECODERFORMATTING),
];
macro_rules! log {
($($arg:tt)*) => (dbg_do!(ROC_PRINT_LOAD_LOG, println!($($arg)*)))
}
@ -2249,6 +2257,7 @@ fn update<'a>(
.imported_modules
.insert(ModuleId::LIST, Region::zero());
// ENCODE
header
.package_qualified_imported_modules
.insert(PackageQualified::Unqualified(ModuleId::ENCODE));
@ -2262,6 +2271,21 @@ fn update<'a>(
.exposed_imports
.insert(Ident::from(*type_name), (*symbol, Region::zero()));
}
// DECODE
header
.package_qualified_imported_modules
.insert(PackageQualified::Unqualified(ModuleId::DECODE));
header
.imported_modules
.insert(ModuleId::DECODE, Region::zero());
for (type_name, symbol) in MODULE_DECODE_TYPES {
header
.exposed_imports
.insert(Ident::from(*type_name), (*symbol, Region::zero()));
}
}
state