mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-29 03:35:10 +03:00
remove const keyword
This commit is contained in:
parent
1898cc6840
commit
f1bf6c90eb
@ -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(),
|
||||
|
@ -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"),
|
||||
}
|
||||
}
|
||||
|
@ -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),
|
||||
}
|
||||
|
||||
|
@ -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 " }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user