Use std::rc::Rc types for variable declarations
These fields may have to be shared in other data structures, such as a variable declaration stack. In order to accomplish that, it’s necessary to wrap the variable declarations in std::rc::Rc.
This commit is contained in:
parent
3e6e68f6ea
commit
6163c5b259
12
src/ast.rs
12
src/ast.rs
@ -258,13 +258,13 @@ impl Compare
|
|||||||
|
|
||||||
pub struct Exists
|
pub struct Exists
|
||||||
{
|
{
|
||||||
pub parameters: VariableDeclarations,
|
pub parameters: std::rc::Rc<VariableDeclarations>,
|
||||||
pub argument: Box<Formula>,
|
pub argument: Box<Formula>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Exists
|
impl Exists
|
||||||
{
|
{
|
||||||
pub fn new(parameters: VariableDeclarations, argument: Box<Formula>) -> Self
|
pub fn new(parameters: std::rc::Rc<VariableDeclarations>, argument: Box<Formula>) -> Self
|
||||||
{
|
{
|
||||||
Self
|
Self
|
||||||
{
|
{
|
||||||
@ -276,13 +276,13 @@ impl Exists
|
|||||||
|
|
||||||
pub struct ForAll
|
pub struct ForAll
|
||||||
{
|
{
|
||||||
pub parameters: VariableDeclarations,
|
pub parameters: std::rc::Rc<VariableDeclarations>,
|
||||||
pub argument: Box<Formula>,
|
pub argument: Box<Formula>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ForAll
|
impl ForAll
|
||||||
{
|
{
|
||||||
pub fn new(parameters: VariableDeclarations, argument: Box<Formula>) -> Self
|
pub fn new(parameters: std::rc::Rc<VariableDeclarations>, argument: Box<Formula>) -> Self
|
||||||
{
|
{
|
||||||
Self
|
Self
|
||||||
{
|
{
|
||||||
@ -504,7 +504,7 @@ impl Formula
|
|||||||
Self::Compare(Compare::new(operator, left, right))
|
Self::Compare(Compare::new(operator, left, right))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn exists(parameters: VariableDeclarations, argument: Box<Formula>) -> Self
|
pub fn exists(parameters: std::rc::Rc<VariableDeclarations>, argument: Box<Formula>) -> Self
|
||||||
{
|
{
|
||||||
Self::Exists(Exists::new(parameters, argument))
|
Self::Exists(Exists::new(parameters, argument))
|
||||||
}
|
}
|
||||||
@ -519,7 +519,7 @@ impl Formula
|
|||||||
Self::boolean(false)
|
Self::boolean(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn for_all(parameters: VariableDeclarations, argument: Box<Formula>) -> Self
|
pub fn for_all(parameters: std::rc::Rc<VariableDeclarations>, argument: Box<Formula>) -> Self
|
||||||
{
|
{
|
||||||
Self::ForAll(ForAll::new(parameters, argument))
|
Self::ForAll(ForAll::new(parameters, argument))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user