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:
Patrick Lühne 2020-02-02 17:44:49 +01:00
parent 3e6e68f6ea
commit 6163c5b259
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
1 changed files with 6 additions and 6 deletions

View File

@ -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))
} }