Fix builds.

This commit is contained in:
Stephen Chung 2022-12-03 16:29:19 +08:00
parent 55922b5c20
commit 249180b1e0

View File

@ -3235,9 +3235,9 @@ impl Engine {
#[cfg(not(feature = "no_function"))] #[cfg(not(feature = "no_function"))]
#[cfg(feature = "metadata")] #[cfg(feature = "metadata")]
let comments = { let comments = {
let mut comments = StaticVec::<String>::new(); let mut comments = StaticVec::<Identifier>::new();
let mut comments_pos = Position::NONE; let mut comments_pos = Position::NONE;
let mut buf = String::new(); let mut buf = Identifier::new();
// Handle doc-comments. // Handle doc-comments.
while let (Token::Comment(ref comment), pos) = input.peek().expect(NEVER_ENDS) { while let (Token::Comment(ref comment), pos) = input.peek().expect(NEVER_ENDS) {
@ -3263,7 +3263,7 @@ impl Engine {
} }
let c = let c =
unindent_block_comment(*comment, pos.position().unwrap_or(1) - 1); unindent_block_comment(*comment, pos.position().unwrap_or(1) - 1);
comments.push(c); comments.push(c.into());
} else { } else {
if !buf.is_empty() { if !buf.is_empty() {
buf.push('\n'); buf.push('\n');
@ -3365,7 +3365,6 @@ impl Engine {
lib, lib,
access, access,
new_settings, new_settings,
#[cfg(not(feature = "no_function"))]
#[cfg(feature = "metadata")] #[cfg(feature = "metadata")]
comments, comments,
)?; )?;
@ -3567,14 +3566,14 @@ impl Engine {
/// Parse a function definition. /// Parse a function definition.
#[cfg(not(feature = "no_function"))] #[cfg(not(feature = "no_function"))]
fn parse_fn<S: Into<Identifier>>( fn parse_fn(
&self, &self,
input: &mut TokenStream, input: &mut TokenStream,
state: &mut ParseState, state: &mut ParseState,
lib: &mut FnLib, lib: &mut FnLib,
access: crate::FnAccess, access: crate::FnAccess,
settings: ParseSettings, settings: ParseSettings,
#[cfg(feature = "metadata")] comments: impl IntoIterator<Item = S>, #[cfg(feature = "metadata")] comments: impl IntoIterator<Item = Identifier>,
) -> ParseResult<ScriptFnDef> { ) -> ParseResult<ScriptFnDef> {
let settings = settings; let settings = settings;
@ -3659,7 +3658,7 @@ impl Engine {
#[cfg(not(feature = "no_module"))] #[cfg(not(feature = "no_module"))]
environ: None, environ: None,
#[cfg(feature = "metadata")] #[cfg(feature = "metadata")]
comments: comments.into_iter().map(Into::into).collect(), comments: comments.into_iter().collect(),
}) })
} }