fix compilation errors depending on feature selection and update dependency version

This commit is contained in:
Moritz Hölting 2025-01-17 12:27:25 +01:00
parent 6179bebbf0
commit 8223dccc24
5 changed files with 33 additions and 21 deletions

View File

@ -19,26 +19,26 @@ default = ["fs_access", "lua", "shulkerbox", "zip"]
fs_access = ["shulkerbox?/fs_access"] fs_access = ["shulkerbox?/fs_access"]
lua = ["dep:mlua"] lua = ["dep:mlua"]
serde = ["dep:serde", "shulkerbox?/serde"] serde = ["dep:serde", "shulkerbox?/serde"]
shulkerbox = ["dep:shulkerbox"] shulkerbox = ["dep:shulkerbox", "dep:chksum-md5"]
zip = ["shulkerbox?/zip"] zip = ["shulkerbox?/zip"]
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
path-absolutize = { version = "3.1.1", features = ["use_unix_paths_on_wasm"] } path-absolutize = { version = "3.1.1", features = ["use_unix_paths_on_wasm"] }
[dependencies] [dependencies]
chksum-md5 = "0.0.0" chksum-md5 = { version = "0.1.0", optional = true }
colored = "2.1.0" colored = "3.0.0"
derive_more = { version = "1.0.0", default-features = false, features = ["deref", "deref_mut", "from"] } derive_more = { version = "1.0.0", default-features = false, features = ["deref", "deref_mut", "from"] }
enum-as-inner = "0.6.0" enum-as-inner = "0.6.0"
getset = "0.1.2" getset = "0.1.2"
itertools = "0.13.0" itertools = "0.14.0"
mlua = { version = "0.10.0", features = ["lua54", "vendored"], optional = true } mlua = { version = "0.10.2", features = ["lua54", "vendored"], optional = true }
path-absolutize = "3.1.1" path-absolutize = "3.1.1"
pathdiff = "0.2.2" pathdiff = "0.2.3"
serde = { version = "1.0.214", features = ["derive", "rc"], optional = true } serde = { version = "1.0.217", features = ["derive", "rc"], optional = true }
shulkerbox = { version = "0.1.0", default-features = false, optional = true } shulkerbox = { version = "0.1.0", default-features = false, optional = true }
strsim = "0.11.1" strsim = "0.11.1"
strum = { version = "0.26.2", features = ["derive"] } strum = { version = "0.26.2", features = ["derive"] }
strum_macros = "0.26.4" strum_macros = "0.26.4"
thiserror = "1.0.65" thiserror = "2.0.11"
tracing = "0.1.40" tracing = "0.1.41"

View File

@ -12,6 +12,7 @@
#![warn(missing_docs, clippy::all, clippy::pedantic)] #![warn(missing_docs, clippy::all, clippy::pedantic)]
#![allow(clippy::missing_panics_doc, clippy::missing_const_for_fn)] #![allow(clippy::missing_panics_doc, clippy::missing_const_for_fn)]
#[cfg(feature = "shulkerbox")]
pub use shulkerbox; pub use shulkerbox;
pub mod base; pub mod base;

View File

@ -13,7 +13,7 @@ use crate::{
syntax::syntax_tree::expression::Expression, syntax::syntax_tree::expression::Expression,
}; };
use super::transpiler::FunctionData; use super::FunctionData;
/// Errors that can occur during transpilation. /// Errors that can occur during transpilation.
#[allow(clippy::module_name_repetitions, missing_docs)] #[allow(clippy::module_name_repetitions, missing_docs)]
@ -44,6 +44,7 @@ pub struct MissingFunctionDeclaration {
} }
impl MissingFunctionDeclaration { impl MissingFunctionDeclaration {
#[cfg_attr(not(feature = "shulkerbox"), expect(unused))]
pub(super) fn from_context( pub(super) fn from_context(
identifier_span: Span, identifier_span: Span,
functions: &BTreeMap<(String, String), FunctionData>, functions: &BTreeMap<(String, String), FunctionData>,

View File

@ -1,9 +1,14 @@
//! The transpile module is responsible for transpiling the abstract syntax tree into a data pack. //! The transpile module is responsible for transpiling the abstract syntax tree into a data pack.
use std::collections::HashMap;
use crate::{base::source_file::Span, syntax::syntax_tree::statement::Statement};
#[doc(hidden)] #[doc(hidden)]
#[cfg(feature = "shulkerbox")] #[cfg(feature = "shulkerbox")]
pub mod conversions; pub mod conversions;
mod error; mod error;
#[doc(inline)] #[doc(inline)]
#[allow(clippy::module_name_repetitions)] #[allow(clippy::module_name_repetitions)]
pub use error::{TranspileError, TranspileResult}; pub use error::{TranspileError, TranspileResult};
@ -11,7 +16,18 @@ pub use error::{TranspileError, TranspileResult};
pub mod lua; pub mod lua;
#[cfg(feature = "shulkerbox")] #[cfg(feature = "shulkerbox")]
mod transpiler; mod transpiler;
#[doc(inline)] #[cfg(feature = "shulkerbox")]
#[cfg_attr(feature = "shulkerbox", doc(inline))]
pub use transpiler::Transpiler; pub use transpiler::Transpiler;
#[cfg(feature = "shulkerbox")]
mod util; mod util;
#[derive(Debug, Clone, PartialEq, Eq)]
pub(super) struct FunctionData {
pub(super) namespace: String,
pub(super) identifier_span: Span,
pub(super) statements: Vec<Statement>,
pub(super) public: bool,
pub(super) annotations: HashMap<String, Option<String>>,
}

View File

@ -26,7 +26,10 @@ use crate::{
transpile::error::{ConflictingFunctionNames, MissingFunctionDeclaration}, transpile::error::{ConflictingFunctionNames, MissingFunctionDeclaration},
}; };
use super::error::{TranspileError, TranspileResult, UnexpectedExpression}; use super::{
error::{TranspileError, TranspileResult, UnexpectedExpression},
FunctionData,
};
/// A transpiler for `Shulkerscript`. /// A transpiler for `Shulkerscript`.
#[derive(Debug)] #[derive(Debug)]
@ -40,15 +43,6 @@ pub struct Transpiler {
aliases: HashMap<(String, String), (String, String)>, aliases: HashMap<(String, String), (String, String)>,
} }
#[derive(Debug, Clone, PartialEq, Eq)]
pub(super) struct FunctionData {
pub(super) namespace: String,
pub(super) identifier_span: Span,
pub(super) statements: Vec<Statement>,
pub(super) public: bool,
pub(super) annotations: HashMap<String, Option<String>>,
}
impl Transpiler { impl Transpiler {
/// Creates a new transpiler. /// Creates a new transpiler.
#[must_use] #[must_use]