Fixed where module needs to be placed
This commit is contained in:
@@ -16,6 +16,7 @@ pub struct MistParser;
|
||||
|
||||
pub fn parse<'a>(
|
||||
source: &'a str,
|
||||
is_master: bool,
|
||||
) -> Result<((Visibility, Identifier), Vec<TopLevel>), ParseError<'a, Vec<TopLevel>>> {
|
||||
let mut pairs = MistParser::parse(Rule::program, source)?;
|
||||
|
||||
@@ -29,6 +30,13 @@ pub fn parse<'a>(
|
||||
}
|
||||
}
|
||||
|
||||
if is_master {
|
||||
return match analyzer.build(statements) {
|
||||
Ok(v) => Ok(((Visibility::Private, Identifier(String::new())), v)),
|
||||
Err(e) => Err(ParseError::Ast(e)),
|
||||
};
|
||||
}
|
||||
|
||||
let m = if let Some(v) = statements.get(0) {
|
||||
if let TopLevelKind::DeclareModule(vis, name) = &v.0.item {
|
||||
(vis.clone(), name.clone())
|
||||
|
||||
Reference in New Issue
Block a user