Merge pull request #61 from bjfish/debug-message-for-mocked-missing-tables-globals

Add debug messages for mocked missing globals and tables
This commit is contained in:
Syrus Akbary 2018-12-16 11:20:55 -08:00 committed by GitHub
commit ae210253b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -394,6 +394,10 @@ impl Instance {
Some(ImportValue::Global(value)) => *value, Some(ImportValue::Global(value)) => *value,
None => { None => {
if options.mock_missing_globals { if options.mock_missing_globals {
debug!(
"The Imported global {}.{} is not provided, therefore will be mocked.",
module_name, field_name
);
0 0
} else { } else {
panic!( panic!(
@ -430,6 +434,10 @@ impl Instance {
Some(ImportValue::Table(t)) => t.to_vec(), Some(ImportValue::Table(t)) => t.to_vec(),
None => { None => {
if options.mock_missing_tables { if options.mock_missing_tables {
debug!(
"The Imported table {}.{} is not provided, therefore will be mocked.",
module_name, field_name
);
let len = table.entity.size; let len = table.entity.size;
let mut v = Vec::with_capacity(len); let mut v = Vec::with_capacity(len);
v.resize(len, 0); v.resize(len, 0);