implement From for Expression-types
This commit is contained in:
parent
58779f8470
commit
b198984fc5
@ -1,4 +1,7 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::convert::From;
|
||||||
|
|
||||||
|
use source_map::{SourceMap};
|
||||||
|
|
||||||
use builtin::{BinOp, PrefixOp};
|
use builtin::{BinOp, PrefixOp};
|
||||||
|
|
||||||
@ -63,6 +66,12 @@ pub enum Variant {
|
|||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct Expression(pub ExpressionType, pub Option<TypeIdentifier>);
|
pub struct Expression(pub ExpressionType, pub Option<TypeIdentifier>);
|
||||||
|
|
||||||
|
impl From<Expression> for SourceMap<Expression> {
|
||||||
|
fn from(node: Expression) -> Self {
|
||||||
|
SourceMap { node, data: None }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub enum TypeIdentifier {
|
pub enum TypeIdentifier {
|
||||||
Tuple(Vec<TypeIdentifier>),
|
Tuple(Vec<TypeIdentifier>),
|
||||||
@ -116,6 +125,13 @@ pub enum ExpressionType {
|
|||||||
},
|
},
|
||||||
ListLiteral(Vec<Expression>),
|
ListLiteral(Vec<Expression>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<ExpressionType> for SourceMap<ExpressionType> {
|
||||||
|
fn from(node: ExpressionType) -> Self {
|
||||||
|
SourceMap { node, data: None }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub enum Discriminator {
|
pub enum Discriminator {
|
||||||
Simple(Expression),
|
Simple(Expression),
|
||||||
|
Loading…
Reference in New Issue
Block a user