mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
FEATURE: Empty files result in Val::Empty as their result.
We also print a warning message for the consumer.
This commit is contained in:
parent
38e418a1d6
commit
3cfbe6564c
@ -1648,7 +1648,12 @@ impl<'a> FileBuilder<'a> {
|
|||||||
Some(importer) => {
|
Some(importer) => {
|
||||||
let file_contents =
|
let file_contents =
|
||||||
self.get_file_as_string(&def.path.pos, &def.path.fragment)?;
|
self.get_file_as_string(&def.path.pos, &def.path.fragment)?;
|
||||||
let val = importer.import(file_contents.as_bytes())?;
|
let val = if file_contents.len() == 0 {
|
||||||
|
eprintln!("including an empty file. Use NULL as the result");
|
||||||
|
Rc::new(Val::Empty)
|
||||||
|
} else {
|
||||||
|
importer.import(file_contents.as_bytes())?
|
||||||
|
};
|
||||||
Ok(val)
|
Ok(val)
|
||||||
}
|
}
|
||||||
None => Err(Box::new(error::BuildError::new(
|
None => Err(Box::new(error::BuildError::new(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user