remove const keyword

This commit is contained in:
gluaxspeed 2021-02-08 10:34:33 -05:00
parent 1898cc6840
commit f1bf6c90eb
4 changed files with 1 additions and 8 deletions

View File

@ -92,9 +92,6 @@ impl FromAst<leo_ast::DefinitionStatement> for Arc<Statement> {
}
for (variable, type_) in statement.variable_names.iter().zip(output_types.into_iter()) {
if statement.declaration_type == leo_ast::Declare::Const && variable.mutable {
return Err(AsgConvertError::illegal_ast_structure("cannot have const mut"));
}
variables.push(Arc::new(RefCell::new(InnerVariable {
id: uuid::Uuid::new_v4(),
name: variable.identifier.clone(),

View File

@ -21,14 +21,12 @@ use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum Declare {
Const,
Let,
}
impl<'ast> From<GrammarDeclare> for Declare {
fn from(declare: GrammarDeclare) -> Self {
match declare {
GrammarDeclare::Const(_) => Declare::Const,
GrammarDeclare::Let(_) => Declare::Let,
}
}
@ -37,7 +35,6 @@ impl<'ast> From<GrammarDeclare> for Declare {
impl fmt::Display for Declare {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Declare::Const => write!(f, "const"),
Declare::Let => write!(f, "let"),
}
}

View File

@ -22,7 +22,6 @@ use serde::Serialize;
#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
#[pest_ast(rule(Rule::declare))]
pub enum Declare {
Const(Const),
Let(Let),
}

View File

@ -99,7 +99,7 @@ variable_name_tuple = _{"(" ~ variable_name ~ ("," ~ variable_name)+ ~ ")"}
variables = { ( variable_name_tuple | variable_name ) ~ (":" ~ type_ )? }
// Declared in common/declare.rs
declare = { let_ | const_ }
declare = { let_ }
const_ = { "const " }
let_ = { "let " }