fix compile error without "shulkerbox" feature
This commit is contained in:
parent
d0cee40524
commit
d9f2d99c3a
|
@ -1,7 +1,8 @@
|
||||||
//! Utility methods for transpiling
|
//! Utility methods for transpiling
|
||||||
|
|
||||||
use std::{fmt::Display, str::FromStr, sync::Arc};
|
use std::{fmt::Display, str::FromStr};
|
||||||
|
|
||||||
|
#[cfg(feature = "shulkerbox")]
|
||||||
use crate::{
|
use crate::{
|
||||||
base::{self, source_file::SourceElement as _, Handler},
|
base::{self, source_file::SourceElement as _, Handler},
|
||||||
syntax::syntax_tree::{
|
syntax::syntax_tree::{
|
||||||
|
@ -10,11 +11,12 @@ use crate::{
|
||||||
},
|
},
|
||||||
transpile::{
|
transpile::{
|
||||||
error::{TranspileError, UnknownIdentifier},
|
error::{TranspileError, UnknownIdentifier},
|
||||||
|
expression::ComptimeValue,
|
||||||
Scope, TranspileResult, VariableData,
|
Scope, TranspileResult, VariableData,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
#[cfg(feature = "shulkerbox")]
|
||||||
use super::expression::ComptimeValue;
|
use std::sync::Arc;
|
||||||
|
|
||||||
/// String that can contain macros
|
/// String that can contain macros
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
|
@ -256,6 +258,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "shulkerbox")]
|
||||||
impl AnyStringLiteral {
|
impl AnyStringLiteral {
|
||||||
/// Convert the any string literal to a macro string, using the provided scope to resolve variables
|
/// Convert the any string literal to a macro string, using the provided scope to resolve variables
|
||||||
///
|
///
|
||||||
|
@ -273,6 +276,7 @@ impl AnyStringLiteral {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "shulkerbox")]
|
||||||
impl TemplateStringLiteral {
|
impl TemplateStringLiteral {
|
||||||
/// Convert the template string literal to a macro string, using the provided scope to resolve variables
|
/// Convert the template string literal to a macro string, using the provided scope to resolve variables
|
||||||
///
|
///
|
||||||
|
@ -312,7 +316,7 @@ impl TemplateStringLiteral {
|
||||||
|| "null".into(),
|
|| "null".into(),
|
||||||
ComptimeValue::to_macro_string,
|
ComptimeValue::to_macro_string,
|
||||||
);
|
);
|
||||||
|
|
||||||
match value.as_str() {
|
match value.as_str() {
|
||||||
Ok(s) => Ok(MacroStringPart::String(s.into_owned())),
|
Ok(s) => Ok(MacroStringPart::String(s.into_owned())),
|
||||||
Err(_) => todo!("comptime value resulting in macro string with macros")
|
Err(_) => todo!("comptime value resulting in macro string with macros")
|
||||||
|
@ -345,7 +349,9 @@ impl TemplateStringLiteral {
|
||||||
|
|
||||||
Ok(macro_string)
|
Ok(macro_string)
|
||||||
} else {
|
} else {
|
||||||
Ok(MacroString::String(self.as_str(scope, handler)?.into_owned()))
|
Ok(MacroString::String(
|
||||||
|
self.as_str(scope, handler)?.into_owned(),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue