Keep module docs as one string.

This commit is contained in:
Stephen Chung
2022-07-25 14:11:54 +08:00
parent 148bbcb860
commit 96bfd93610
3 changed files with 42 additions and 21 deletions

View File

@@ -2,7 +2,6 @@
use crate::parser::{ParseResult, ParseState};
use crate::{Engine, OptimizationLevel, Scope, AST};
use std::mem;
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
@@ -225,9 +224,7 @@ impl Engine {
let mut state = ParseState::new(self, scope, tokenizer_control);
let mut ast = self.parse(&mut stream.peekable(), &mut state, optimization_level)?;
#[cfg(feature = "metadata")]
ast.set_doc(mem::take(
&mut state.tokenizer_control.borrow_mut().global_comments,
));
ast.set_doc(state.tokenizer_control.borrow().global_comments.join("\n"));
Ok(ast)
}
/// Compile a string containing an expression into an [`AST`],