mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-26 19:51:52 +03:00
Merge pull request #2522 from AleoHQ/design/node-id
[Design] Add `id` to AST nodes.
This commit is contained in:
commit
7cd6e757bf
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Identifier, Node, Type};
|
||||
use crate::{Identifier, Node, NodeID, Type};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -29,6 +29,8 @@ pub struct AssociatedConstant {
|
||||
pub name: Identifier,
|
||||
/// The span for the entire expression `Foo::bar()`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for AssociatedConstant {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Expression, Identifier, Node, Type};
|
||||
use crate::{Expression, Identifier, Node, NodeID, Type};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -31,6 +31,8 @@ pub struct AssociatedFunction {
|
||||
pub arguments: Vec<Expression>,
|
||||
/// The span for the entire expression `Foo::bar()`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for AssociatedFunction {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Expression, Identifier, Node};
|
||||
use crate::{Expression, Identifier, Node, NodeID};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -29,6 +29,8 @@ pub struct MemberAccess {
|
||||
pub name: Identifier,
|
||||
/// The span covering all of `inner.name`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for MemberAccess {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Expression, Node, PositiveNumber};
|
||||
use crate::{Expression, Node, NodeID, PositiveNumber};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -29,6 +29,8 @@ pub struct TupleAccess {
|
||||
pub index: PositiveNumber,
|
||||
/// The span for the entire expression `tuple.index`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for TupleAccess {
|
||||
|
@ -1,53 +0,0 @@
|
||||
// Copyright (C) 2019-2023 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{DefinitionStatement, Identifier};
|
||||
|
||||
use leo_span::Symbol;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub fn serialize<S: Serializer>(
|
||||
global_consts: &IndexMap<Vec<Identifier>, DefinitionStatement>,
|
||||
serializer: S,
|
||||
) -> Result<S::Ok, S::Error> {
|
||||
let joined: IndexMap<String, DefinitionStatement> = global_consts
|
||||
.into_iter()
|
||||
.map(|(idents, program)| {
|
||||
(idents.iter().map(|i| i.name.to_string()).collect::<Vec<_>>().join(","), program.clone())
|
||||
})
|
||||
.collect();
|
||||
|
||||
joined.serialize(serializer)
|
||||
}
|
||||
|
||||
pub fn deserialize<'de, D: Deserializer<'de>>(
|
||||
deserializer: D,
|
||||
) -> Result<IndexMap<Vec<Identifier>, DefinitionStatement>, D::Error> {
|
||||
Ok(IndexMap::<String, DefinitionStatement>::deserialize(deserializer)?
|
||||
.into_iter()
|
||||
.map(|(name, program)| {
|
||||
(
|
||||
name.split(',')
|
||||
.map(|ident_name| Identifier { name: Symbol::intern(ident_name), span: Default::default() })
|
||||
.collect::<Vec<Identifier>>(),
|
||||
program,
|
||||
)
|
||||
})
|
||||
.collect())
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
use leo_errors::Result;
|
||||
use leo_span::{Span, Symbol};
|
||||
|
||||
use crate::{simple_node_impl, Node};
|
||||
use crate::{simple_node_impl, Node, NodeID};
|
||||
use serde::{
|
||||
de::{
|
||||
Visitor,
|
||||
@ -45,6 +45,8 @@ pub struct Identifier {
|
||||
pub name: Symbol,
|
||||
/// A span locating where the identifier occurred in the source.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
simple_node_impl!(Identifier);
|
||||
@ -52,7 +54,7 @@ simple_node_impl!(Identifier);
|
||||
impl Identifier {
|
||||
/// Constructs a new identifier with `name` and a default span.
|
||||
pub fn new(name: Symbol) -> Self {
|
||||
Self { name, span: Span::default() }
|
||||
Self { name, span: Span::default(), id: NodeID::default() }
|
||||
}
|
||||
|
||||
/// Check if the Identifier name matches the other name.
|
||||
@ -137,7 +139,12 @@ impl<'de> Deserialize<'de> for Identifier {
|
||||
None => return Err(E::custom("missing 'span' in serialized Identifier struct")),
|
||||
};
|
||||
|
||||
Ok(Identifier { name, span })
|
||||
let id: NodeID = match key.get("id") {
|
||||
Some(id) => to_json_string(id)?,
|
||||
None => return Err(E::custom("missing 'id' in serialized Identifier struct")),
|
||||
};
|
||||
|
||||
Ok(Identifier { name, span, id })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
pub mod global_consts_json;
|
||||
|
||||
pub mod identifier;
|
||||
pub use identifier::*;
|
||||
|
||||
|
@ -16,6 +16,12 @@
|
||||
|
||||
use leo_span::Span;
|
||||
|
||||
/// A node ID.
|
||||
// Development Note:
|
||||
// A `NodeID` must implement: `Copy`, `Default`, among others.
|
||||
// TODO (@d0cd): Replace use of `NodeID::default()` with unique IDs in the rest of the codebase.
|
||||
pub type NodeID = usize;
|
||||
|
||||
/// A node in the AST.
|
||||
pub trait Node:
|
||||
std::fmt::Debug + std::fmt::Display + Clone + PartialEq + Eq + serde::Serialize + serde::de::DeserializeOwned
|
||||
@ -25,6 +31,12 @@ pub trait Node:
|
||||
|
||||
/// Sets the span of the node.
|
||||
fn set_span(&mut self, span: Span);
|
||||
|
||||
/// Returns the ID of the node.
|
||||
fn id(&self) -> NodeID;
|
||||
|
||||
/// Sets the ID of the node.
|
||||
fn set_id(&mut self, id: NodeID);
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
@ -38,6 +50,14 @@ macro_rules! simple_node_impl {
|
||||
fn set_span(&mut self, span: Span) {
|
||||
self.span = span;
|
||||
}
|
||||
|
||||
fn id(&self) -> NodeID {
|
||||
self.id
|
||||
}
|
||||
|
||||
fn set_id(&mut self, id: NodeID) {
|
||||
self.id = id;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{access::*, Node};
|
||||
use crate::{access::*, Node, NodeID};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -55,12 +55,29 @@ impl Node for AccessExpression {
|
||||
AccessExpression::Tuple(n) => n.set_span(span),
|
||||
}
|
||||
}
|
||||
|
||||
fn id(&self) -> NodeID {
|
||||
match self {
|
||||
AccessExpression::AssociatedConstant(n) => n.id(),
|
||||
AccessExpression::AssociatedFunction(n) => n.id(),
|
||||
AccessExpression::Member(n) => n.id(),
|
||||
AccessExpression::Tuple(n) => n.id(),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_id(&mut self, id: NodeID) {
|
||||
match self {
|
||||
AccessExpression::AssociatedConstant(n) => n.set_id(id),
|
||||
AccessExpression::AssociatedFunction(n) => n.set_id(id),
|
||||
AccessExpression::Member(n) => n.set_id(id),
|
||||
AccessExpression::Tuple(n) => n.set_id(id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for AccessExpression {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
use AccessExpression::*;
|
||||
|
||||
match self {
|
||||
AssociatedConstant(access) => access.fmt(f),
|
||||
AssociatedFunction(access) => access.fmt(f),
|
||||
|
@ -171,6 +171,8 @@ pub struct BinaryExpression {
|
||||
pub op: BinaryOperation,
|
||||
/// The span from `left` to `right`.
|
||||
pub span: Span,
|
||||
/// The ID of the expression.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for BinaryExpression {
|
||||
|
@ -28,6 +28,8 @@ pub struct CallExpression {
|
||||
pub external: Option<Box<Expression>>,
|
||||
/// Span of the entire call `function(arguments)`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for CallExpression {
|
||||
|
@ -27,6 +27,8 @@ pub struct CastExpression {
|
||||
pub type_: Type,
|
||||
/// Span of the entire cast `42u8 as u16`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for CastExpression {
|
||||
|
@ -21,6 +21,8 @@ use super::*;
|
||||
pub struct ErrExpression {
|
||||
/// The span of the invalid expression.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for ErrExpression {
|
||||
|
@ -24,34 +24,34 @@ use super::*;
|
||||
pub enum Literal {
|
||||
// todo: deserialize values here
|
||||
/// An address literal, e.g., `aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8s7pyjh9`.
|
||||
Address(String, #[serde(with = "leo_span::span_json")] Span),
|
||||
Address(String, #[serde(with = "leo_span::span_json")] Span, NodeID),
|
||||
/// A boolean literal, either `true` or `false`.
|
||||
Boolean(bool, #[serde(with = "leo_span::span_json")] Span),
|
||||
Boolean(bool, #[serde(with = "leo_span::span_json")] Span, NodeID),
|
||||
/// A field literal, e.g., `42field`.
|
||||
/// A signed number followed by the keyword `field`.
|
||||
Field(String, #[serde(with = "leo_span::span_json")] Span),
|
||||
Field(String, #[serde(with = "leo_span::span_json")] Span, NodeID),
|
||||
/// A group literal, either product or affine.
|
||||
/// For example, `42group` or `(12, 52)group`.
|
||||
Group(Box<GroupLiteral>),
|
||||
/// An integer literal, e.g., `42`.
|
||||
Integer(IntegerType, String, #[serde(with = "leo_span::span_json")] Span),
|
||||
Integer(IntegerType, String, #[serde(with = "leo_span::span_json")] Span, NodeID),
|
||||
/// A scalar literal, e.g. `1scalar`.
|
||||
/// An unsigned number followed by the keyword `scalar`.
|
||||
Scalar(String, #[serde(with = "leo_span::span_json")] Span),
|
||||
Scalar(String, #[serde(with = "leo_span::span_json")] Span, NodeID),
|
||||
/// A string literal, e.g., `"foobar"`.
|
||||
String(String, #[serde(with = "leo_span::span_json")] Span),
|
||||
String(String, #[serde(with = "leo_span::span_json")] Span, NodeID),
|
||||
}
|
||||
|
||||
impl fmt::Display for Literal {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match &self {
|
||||
Self::Address(address, _) => write!(f, "{address}"),
|
||||
Self::Boolean(boolean, _) => write!(f, "{boolean}"),
|
||||
Self::Field(field, _) => write!(f, "{field}field"),
|
||||
Self::Address(address, _, _) => write!(f, "{address}"),
|
||||
Self::Boolean(boolean, _, _) => write!(f, "{boolean}"),
|
||||
Self::Field(field, _, _) => write!(f, "{field}field"),
|
||||
Self::Group(group) => write!(f, "{group}group"),
|
||||
Self::Integer(type_, value, _) => write!(f, "{value}{type_}"),
|
||||
Self::Scalar(scalar, _) => write!(f, "{scalar}scalar"),
|
||||
Self::String(string, _) => write!(f, "\"{string}\""),
|
||||
Self::Integer(type_, value, _, _) => write!(f, "{value}{type_}"),
|
||||
Self::Scalar(scalar, _, _) => write!(f, "{scalar}scalar"),
|
||||
Self::String(string, _, _) => write!(f, "\"{string}\""),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,31 +59,49 @@ impl fmt::Display for Literal {
|
||||
impl Node for Literal {
|
||||
fn span(&self) -> Span {
|
||||
match &self {
|
||||
Self::Address(_, span)
|
||||
| Self::Boolean(_, span)
|
||||
| Self::Field(_, span)
|
||||
| Self::Integer(_, _, span)
|
||||
| Self::Scalar(_, span)
|
||||
| Self::String(_, span) => *span,
|
||||
Self::Group(group) => match &**group {
|
||||
GroupLiteral::Single(_, span) => *span,
|
||||
GroupLiteral::Tuple(tuple) => tuple.span,
|
||||
},
|
||||
Self::Address(_, span, _)
|
||||
| Self::Boolean(_, span, _)
|
||||
| Self::Field(_, span, _)
|
||||
| Self::Integer(_, _, span, _)
|
||||
| Self::Scalar(_, span, _)
|
||||
| Self::String(_, span, _) => *span,
|
||||
Self::Group(group) => *group.span(),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_span(&mut self, new_span: Span) {
|
||||
match self {
|
||||
Self::Address(_, span)
|
||||
| Self::Boolean(_, span)
|
||||
| Self::Field(_, span)
|
||||
| Self::Integer(_, _, span)
|
||||
| Self::Scalar(_, span)
|
||||
| Self::String(_, span) => *span = new_span,
|
||||
Self::Group(group) => match &mut **group {
|
||||
GroupLiteral::Single(_, span) => *span = new_span,
|
||||
GroupLiteral::Tuple(tuple) => tuple.span = new_span,
|
||||
},
|
||||
Self::Address(_, span, _)
|
||||
| Self::Boolean(_, span, _)
|
||||
| Self::Field(_, span, _)
|
||||
| Self::Integer(_, _, span, _)
|
||||
| Self::Scalar(_, span, _)
|
||||
| Self::String(_, span, _) => *span = new_span,
|
||||
Self::Group(group) => group.set_span(new_span),
|
||||
}
|
||||
}
|
||||
|
||||
fn id(&self) -> NodeID {
|
||||
match &self {
|
||||
Self::Address(_, _, id)
|
||||
| Self::Boolean(_, _, id)
|
||||
| Self::Field(_, _, id)
|
||||
| Self::Integer(_, _, _, id)
|
||||
| Self::Scalar(_, _, id)
|
||||
| Self::String(_, _, id) => *id,
|
||||
Self::Group(group) => *group.id(),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_id(&mut self, id: NodeID) {
|
||||
match self {
|
||||
Self::Address(_, _, old_id)
|
||||
| Self::Boolean(_, _, old_id)
|
||||
| Self::Field(_, _, old_id)
|
||||
| Self::Integer(_, _, _, old_id)
|
||||
| Self::Scalar(_, _, old_id)
|
||||
| Self::String(_, _, old_id) => *old_id = id,
|
||||
Self::Group(group) => group.set_id(id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Identifier, Node};
|
||||
use crate::{Identifier, Node, NodeID};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -119,6 +119,42 @@ impl Node for Expression {
|
||||
Unit(n) => n.set_span(span),
|
||||
}
|
||||
}
|
||||
|
||||
fn id(&self) -> NodeID {
|
||||
use Expression::*;
|
||||
match self {
|
||||
Access(n) => n.id(),
|
||||
Binary(n) => n.id(),
|
||||
Call(n) => n.id(),
|
||||
Cast(n) => n.id(),
|
||||
Struct(n) => n.id(),
|
||||
Identifier(n) => n.id(),
|
||||
Literal(n) => n.id(),
|
||||
Err(n) => n.id(),
|
||||
Ternary(n) => n.id(),
|
||||
Tuple(n) => n.id(),
|
||||
Unary(n) => n.id(),
|
||||
Unit(n) => n.id(),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_id(&mut self, id: NodeID) {
|
||||
use Expression::*;
|
||||
match self {
|
||||
Access(n) => n.set_id(id),
|
||||
Binary(n) => n.set_id(id),
|
||||
Call(n) => n.set_id(id),
|
||||
Cast(n) => n.set_id(id),
|
||||
Struct(n) => n.set_id(id),
|
||||
Identifier(n) => n.set_id(id),
|
||||
Literal(n) => n.set_id(id),
|
||||
Err(n) => n.set_id(id),
|
||||
Ternary(n) => n.set_id(id),
|
||||
Tuple(n) => n.set_id(id),
|
||||
Unary(n) => n.set_id(id),
|
||||
Unit(n) => n.set_id(id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Expression {
|
||||
|
@ -26,8 +26,14 @@ pub struct StructVariableInitializer {
|
||||
/// The expression to initialize the field with.
|
||||
/// When `None`, a binding, in scope, with the name will be used instead.
|
||||
pub expression: Option<Expression>,
|
||||
/// The span of the node.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
crate::simple_node_impl!(StructVariableInitializer);
|
||||
|
||||
impl fmt::Display for StructVariableInitializer {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
if let Some(expr) = &self.expression {
|
||||
@ -50,6 +56,8 @@ pub struct StructExpression {
|
||||
pub members: Vec<StructVariableInitializer>,
|
||||
/// A span from `name` to `}`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl StructExpression {
|
||||
|
@ -27,6 +27,8 @@ pub struct TernaryExpression {
|
||||
pub if_false: Box<Expression>,
|
||||
/// The span from `condition` to `if_false`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for TernaryExpression {
|
||||
|
@ -26,6 +26,8 @@ pub struct TupleExpression {
|
||||
pub elements: Vec<Expression>,
|
||||
/// The span from `(` to `)`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for TupleExpression {
|
||||
|
@ -86,6 +86,8 @@ pub struct UnaryExpression {
|
||||
pub op: UnaryOperation,
|
||||
/// The span covering `op inner`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for UnaryExpression {
|
||||
|
@ -21,6 +21,8 @@ use super::*;
|
||||
pub struct UnitExpression {
|
||||
/// The span of the unit expression.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for UnitExpression {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{simple_node_impl, Identifier, Node};
|
||||
use crate::{simple_node_impl, Identifier, Node, NodeID};
|
||||
|
||||
use leo_span::Span;
|
||||
|
||||
@ -29,6 +29,8 @@ pub struct Annotation {
|
||||
pub identifier: Identifier,
|
||||
/// A span locating where the annotation occurred in the source.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
simple_node_impl!(Annotation);
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Identifier, Node, Type};
|
||||
use crate::{Identifier, Node, NodeID, Type};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -31,6 +31,8 @@ pub struct External {
|
||||
pub record: Identifier,
|
||||
/// The parameters span from any annotations to its type.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl External {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Block, Identifier, Input, Node, Output, Tuple, Type};
|
||||
use crate::{Block, Identifier, Input, Node, NodeID, Output, Tuple, Type};
|
||||
|
||||
use leo_span::Span;
|
||||
|
||||
@ -36,6 +36,8 @@ pub struct Finalize {
|
||||
pub block: Block,
|
||||
/// The entire span of the finalize block.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl Finalize {
|
||||
@ -47,7 +49,7 @@ impl Finalize {
|
||||
_ => Type::Tuple(Tuple(output.iter().map(|output| output.type_()).collect())),
|
||||
};
|
||||
|
||||
Self { identifier, input, output, output_type, block, span }
|
||||
Self { identifier, input, output, output_type, block, span, id: NodeID::default() }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{External, Identifier, Mode, Node, Type};
|
||||
use crate::{External, Identifier, Mode, Node, NodeID, Type};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -78,6 +78,22 @@ impl Node for Input {
|
||||
External(input) => input.set_span(span),
|
||||
}
|
||||
}
|
||||
|
||||
fn id(&self) -> usize {
|
||||
use Input::*;
|
||||
match self {
|
||||
Internal(input) => input.id(),
|
||||
External(input) => input.id(),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_id(&mut self, id: usize) {
|
||||
use Input::*;
|
||||
match self {
|
||||
Internal(input) => input.set_id(id),
|
||||
External(input) => input.set_id(id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A function parameter.
|
||||
@ -91,6 +107,8 @@ pub struct FunctionInput {
|
||||
pub type_: Type,
|
||||
/// The parameters span from any annotations to its type.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl FunctionInput {
|
||||
|
@ -38,7 +38,7 @@ pub use output::*;
|
||||
pub mod mode;
|
||||
pub use mode::*;
|
||||
|
||||
use crate::{Block, Identifier, Node, Tuple, Type};
|
||||
use crate::{Block, Identifier, Node, NodeID, Tuple, Type};
|
||||
use leo_span::{sym, Span, Symbol};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -65,6 +65,8 @@ pub struct Function {
|
||||
pub finalize: Option<Finalize>,
|
||||
/// The entire span of the function definition.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl PartialEq for Function {
|
||||
@ -100,7 +102,18 @@ impl Function {
|
||||
_ => Type::Tuple(Tuple(output.iter().map(|output| get_output_type(output)).collect())),
|
||||
};
|
||||
|
||||
Function { annotations, variant, identifier, input, output, output_type, block, finalize, span }
|
||||
Function {
|
||||
annotations,
|
||||
variant,
|
||||
identifier,
|
||||
input,
|
||||
output,
|
||||
output_type,
|
||||
block,
|
||||
finalize,
|
||||
span,
|
||||
id: NodeID::default(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns function name.
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{External, Mode, Node, Type};
|
||||
use crate::{External, Mode, Node, NodeID, Type};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -68,6 +68,22 @@ impl Node for Output {
|
||||
External(output) => output.set_span(span),
|
||||
}
|
||||
}
|
||||
|
||||
fn id(&self) -> NodeID {
|
||||
use Output::*;
|
||||
match self {
|
||||
Internal(output) => output.id(),
|
||||
External(output) => output.id(),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_id(&mut self, id: NodeID) {
|
||||
use Output::*;
|
||||
match self {
|
||||
Internal(output) => output.set_id(id),
|
||||
External(output) => output.set_id(id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A function output.
|
||||
@ -79,6 +95,8 @@ pub struct FunctionOutput {
|
||||
pub type_: Type,
|
||||
/// The parameters span from any annotations to its type.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for FunctionOutput {
|
||||
|
@ -14,7 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::groups::GroupCoordinate;
|
||||
use crate::{groups::GroupCoordinate, NodeID};
|
||||
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -24,7 +25,7 @@ use std::fmt;
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum GroupLiteral {
|
||||
/// Product group literal, e.g., `42group`.
|
||||
Single(String, #[serde(with = "leo_span::span_json")] Span),
|
||||
Single(String, #[serde(with = "leo_span::span_json")] Span, NodeID),
|
||||
/// An affine group literal with (x, y) coordinates.
|
||||
Tuple(GroupTuple),
|
||||
}
|
||||
@ -32,23 +33,37 @@ pub enum GroupLiteral {
|
||||
impl GroupLiteral {
|
||||
pub fn set_span(&mut self, new_span: Span) {
|
||||
match self {
|
||||
Self::Single(_, old_span) => *old_span = new_span,
|
||||
Self::Single(_, old_span, _) => *old_span = new_span,
|
||||
Self::Tuple(tuple) => tuple.span = new_span,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn span(&self) -> &Span {
|
||||
match self {
|
||||
Self::Single(_, span) => span,
|
||||
Self::Single(_, span, _) => span,
|
||||
Self::Tuple(tuple) => &tuple.span,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn id(&self) -> &NodeID {
|
||||
match self {
|
||||
Self::Single(_, _, id) => id,
|
||||
Self::Tuple(tuple) => &tuple.id,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_id(&mut self, id: NodeID) {
|
||||
match self {
|
||||
Self::Single(_, _, old_id) => *old_id = id,
|
||||
Self::Tuple(tuple) => tuple.id = id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for GroupLiteral {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Self::Single(string, _) => write!(f, "{string}"),
|
||||
Self::Single(string, _, _) => write!(f, "{string}"),
|
||||
Self::Tuple(tuple) => write!(f, "{}", tuple.x), // Temporarily emit x coordinate only.
|
||||
}
|
||||
}
|
||||
@ -63,4 +78,6 @@ pub struct GroupTuple {
|
||||
pub y: GroupCoordinate,
|
||||
/// The span from `(` to `)`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
@ -35,11 +35,11 @@ impl TryFrom<(Type, Expression)> for InputValue {
|
||||
fn try_from(value: (Type, Expression)) -> Result<Self> {
|
||||
Ok(match value {
|
||||
(type_, Expression::Literal(lit)) => match (type_, lit) {
|
||||
(Type::Address, Literal::Address(value, _)) => Self::Address(value),
|
||||
(Type::Boolean, Literal::Boolean(value, _)) => Self::Boolean(value),
|
||||
(Type::Field, Literal::Field(value, _)) => Self::Field(value),
|
||||
(Type::Address, Literal::Address(value, _, _)) => Self::Address(value),
|
||||
(Type::Boolean, Literal::Boolean(value, _, _)) => Self::Boolean(value),
|
||||
(Type::Field, Literal::Field(value, _, _)) => Self::Field(value),
|
||||
(Type::Group, Literal::Group(value)) => Self::Group(*value),
|
||||
(Type::Integer(expected), Literal::Integer(actual, value, span)) => {
|
||||
(Type::Integer(expected), Literal::Integer(actual, value, span, _)) => {
|
||||
if expected == actual {
|
||||
Self::Integer(expected, value)
|
||||
} else {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Identifier, Node, Type};
|
||||
use crate::{Identifier, Node, NodeID, Type};
|
||||
|
||||
use leo_span::Span;
|
||||
|
||||
@ -32,6 +32,8 @@ pub struct Mapping {
|
||||
pub value_type: Type,
|
||||
/// The entire span of the mapping declaration.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for Mapping {
|
||||
|
@ -54,17 +54,20 @@ pub trait ExpressionReconstructor {
|
||||
.map(|arg| self.reconstruct_expression(arg).0)
|
||||
.collect(),
|
||||
span: function.span,
|
||||
id: function.id,
|
||||
})
|
||||
}
|
||||
AccessExpression::Member(member) => AccessExpression::Member(MemberAccess {
|
||||
inner: Box::new(self.reconstruct_expression(*member.inner).0),
|
||||
name: member.name,
|
||||
span: member.span,
|
||||
id: member.id,
|
||||
}),
|
||||
AccessExpression::Tuple(tuple) => AccessExpression::Tuple(TupleAccess {
|
||||
tuple: Box::new(self.reconstruct_expression(*tuple.tuple).0),
|
||||
index: tuple.index,
|
||||
span: tuple.span,
|
||||
id: tuple.id,
|
||||
}),
|
||||
AccessExpression::AssociatedConstant(constant) => AccessExpression::AssociatedConstant(constant),
|
||||
}),
|
||||
@ -79,6 +82,7 @@ pub trait ExpressionReconstructor {
|
||||
right: Box::new(self.reconstruct_expression(*input.right).0),
|
||||
op: input.op,
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -91,6 +95,7 @@ pub trait ExpressionReconstructor {
|
||||
arguments: input.arguments.into_iter().map(|arg| self.reconstruct_expression(arg).0).collect(),
|
||||
external: input.external,
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -102,6 +107,7 @@ pub trait ExpressionReconstructor {
|
||||
expression: Box::new(self.reconstruct_expression(*input.expression).0),
|
||||
type_: input.type_,
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -130,6 +136,7 @@ pub trait ExpressionReconstructor {
|
||||
if_true: Box::new(self.reconstruct_expression(*input.if_true).0),
|
||||
if_false: Box::new(self.reconstruct_expression(*input.if_false).0),
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -140,6 +147,7 @@ pub trait ExpressionReconstructor {
|
||||
Expression::Tuple(TupleExpression {
|
||||
elements: input.elements.into_iter().map(|element| self.reconstruct_expression(element).0).collect(),
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -151,6 +159,7 @@ pub trait ExpressionReconstructor {
|
||||
receiver: Box::new(self.reconstruct_expression(*input.receiver).0),
|
||||
op: input.op,
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -195,6 +204,7 @@ pub trait StatementReconstructor: ExpressionReconstructor {
|
||||
),
|
||||
},
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -206,6 +216,7 @@ pub trait StatementReconstructor: ExpressionReconstructor {
|
||||
place: input.place,
|
||||
value: self.reconstruct_expression(input.value).0,
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
})),
|
||||
Default::default(),
|
||||
)
|
||||
@ -216,6 +227,7 @@ pub trait StatementReconstructor: ExpressionReconstructor {
|
||||
Block {
|
||||
statements: input.statements.into_iter().map(|s| self.reconstruct_statement(s).0).collect(),
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
},
|
||||
Default::default(),
|
||||
)
|
||||
@ -228,6 +240,7 @@ pub trait StatementReconstructor: ExpressionReconstructor {
|
||||
then: self.reconstruct_block(input.then).0,
|
||||
otherwise: input.otherwise.map(|n| Box::new(self.reconstruct_statement(*n).0)),
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -248,6 +261,7 @@ pub trait StatementReconstructor: ExpressionReconstructor {
|
||||
),
|
||||
},
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -261,6 +275,7 @@ pub trait StatementReconstructor: ExpressionReconstructor {
|
||||
type_: input.type_,
|
||||
value: self.reconstruct_expression(input.value).0,
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -271,6 +286,7 @@ pub trait StatementReconstructor: ExpressionReconstructor {
|
||||
Statement::Expression(ExpressionStatement {
|
||||
expression: self.reconstruct_expression(input.expression).0,
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -288,6 +304,7 @@ pub trait StatementReconstructor: ExpressionReconstructor {
|
||||
block: self.reconstruct_block(input.block).0,
|
||||
inclusive: input.inclusive,
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
})),
|
||||
Default::default(),
|
||||
)
|
||||
@ -301,6 +318,7 @@ pub trait StatementReconstructor: ExpressionReconstructor {
|
||||
arguments.into_iter().map(|argument| self.reconstruct_expression(argument).0).collect()
|
||||
}),
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -350,8 +368,10 @@ pub trait ProgramReconstructor: StatementReconstructor {
|
||||
output_type: finalize.output_type,
|
||||
block: self.reconstruct_block(finalize.block).0,
|
||||
span: finalize.span,
|
||||
id: finalize.id,
|
||||
}),
|
||||
span: input.span,
|
||||
id: input.id,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Expression, Node};
|
||||
use crate::{Expression, Node, NodeID};
|
||||
|
||||
use leo_span::Span;
|
||||
|
||||
@ -39,6 +39,8 @@ pub struct AssertStatement {
|
||||
pub variant: AssertVariant,
|
||||
/// The span, excluding the semicolon.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for AssertStatement {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Expression, Node};
|
||||
use crate::{Expression, Node, NodeID};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -31,6 +31,8 @@ pub struct AssignStatement {
|
||||
pub value: Expression,
|
||||
/// The span, excluding the semicolon.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for AssignStatement {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Node, Statement};
|
||||
use crate::{Node, NodeID, Statement};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -27,6 +27,8 @@ pub struct Block {
|
||||
pub statements: Vec<Statement>,
|
||||
/// The span from `{` to `}`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for Block {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Block, Expression, Node, Statement};
|
||||
use crate::{Block, Expression, Node, NodeID, Statement};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -31,6 +31,8 @@ pub struct ConditionalStatement {
|
||||
pub otherwise: Option<Box<Statement>>,
|
||||
/// The span from `if` to `next` or to `block`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for ConditionalStatement {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{ConsoleFunction, Node};
|
||||
use crate::{ConsoleFunction, Node, NodeID};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -27,6 +27,8 @@ pub struct ConsoleStatement {
|
||||
pub function: ConsoleFunction,
|
||||
/// The span excluding the semicolon.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for ConsoleStatement {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Expression, Node, Type};
|
||||
use crate::{Expression, Node, NodeID, Type};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -36,6 +36,8 @@ pub struct DefinitionStatement {
|
||||
pub value: Expression,
|
||||
/// The span excluding the semicolon.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for DefinitionStatement {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Expression, Node};
|
||||
use crate::{Expression, Node, NodeID};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -27,6 +27,8 @@ pub struct ExpressionStatement {
|
||||
pub expression: Expression,
|
||||
/// The span.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for ExpressionStatement {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Block, Expression, Identifier, Node, Type, Value};
|
||||
use crate::{Block, Expression, Identifier, Node, NodeID, Type, Value};
|
||||
|
||||
use leo_span::Span;
|
||||
|
||||
@ -45,6 +45,8 @@ pub struct IterationStatement {
|
||||
pub block: Block,
|
||||
/// The span from `for` to `block`.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for IterationStatement {
|
||||
|
@ -41,7 +41,7 @@ pub use iteration::*;
|
||||
pub mod return_;
|
||||
pub use return_::*;
|
||||
|
||||
use crate::Node;
|
||||
use crate::{Node, NodeID};
|
||||
|
||||
use leo_span::Span;
|
||||
|
||||
@ -74,7 +74,7 @@ pub enum Statement {
|
||||
impl Statement {
|
||||
/// Returns a dummy statement made from an empty block `{}`.
|
||||
pub fn dummy(span: Span) -> Self {
|
||||
Self::Block(Block { statements: Vec::new(), span })
|
||||
Self::Block(Block { statements: Vec::new(), span, id: NodeID::default() })
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,4 +124,34 @@ impl Node for Statement {
|
||||
Return(n) => n.set_span(span),
|
||||
}
|
||||
}
|
||||
|
||||
fn id(&self) -> NodeID {
|
||||
use Statement::*;
|
||||
match self {
|
||||
Assert(n) => n.id(),
|
||||
Assign(n) => n.id(),
|
||||
Block(n) => n.id(),
|
||||
Conditional(n) => n.id(),
|
||||
Console(n) => n.id(),
|
||||
Definition(n) => n.id(),
|
||||
Expression(n) => n.id(),
|
||||
Iteration(n) => n.id(),
|
||||
Return(n) => n.id(),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_id(&mut self, id: NodeID) {
|
||||
use Statement::*;
|
||||
match self {
|
||||
Assert(n) => n.set_id(id),
|
||||
Assign(n) => n.set_id(id),
|
||||
Block(n) => n.set_id(id),
|
||||
Conditional(n) => n.set_id(id),
|
||||
Console(n) => n.set_id(id),
|
||||
Definition(n) => n.set_id(id),
|
||||
Expression(n) => n.set_id(id),
|
||||
Iteration(n) => n.set_id(id),
|
||||
Return(n) => n.set_id(id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Expression, Node};
|
||||
use crate::{Expression, Node, NodeID};
|
||||
use leo_span::Span;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -29,6 +29,8 @@ pub struct ReturnStatement {
|
||||
pub finalize_arguments: Option<Vec<Expression>>,
|
||||
/// The span of `return expression` excluding the semicolon.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl fmt::Display for ReturnStatement {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Identifier, Mode, Node, Type};
|
||||
use crate::{Identifier, Mode, Node, NodeID, Type};
|
||||
|
||||
use leo_span::{Span, Symbol};
|
||||
|
||||
@ -32,6 +32,8 @@ pub struct Member {
|
||||
pub type_: Type,
|
||||
/// The span of the member.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl Member {
|
||||
|
@ -17,7 +17,7 @@
|
||||
pub mod member;
|
||||
pub use member::*;
|
||||
|
||||
use crate::{Identifier, Node};
|
||||
use crate::{Identifier, Node, NodeID};
|
||||
use leo_span::{Span, Symbol};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -40,6 +40,8 @@ pub struct Struct {
|
||||
pub is_record: bool,
|
||||
/// The entire span of the struct definition.
|
||||
pub span: Span,
|
||||
/// The ID of the node.
|
||||
pub id: NodeID,
|
||||
}
|
||||
|
||||
impl PartialEq for Struct {
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{GroupLiteral, Identifier, IntegerType, Literal, Type};
|
||||
use crate::{GroupLiteral, Identifier, IntegerType, Literal, NodeID, Type};
|
||||
|
||||
use leo_errors::{type_name, FlattenError, LeoError, Result};
|
||||
use leo_span::{Span, Symbol};
|
||||
@ -871,13 +871,13 @@ impl TryFrom<&Literal> for Value {
|
||||
/// Converts a literal to a value.
|
||||
fn try_from(literal: &Literal) -> Result<Self, Self::Error> {
|
||||
Ok(match literal {
|
||||
Literal::Address(string, span) => Self::Address(string.clone(), *span),
|
||||
Literal::Boolean(bool, span) => Self::Boolean(*bool, *span),
|
||||
Literal::Field(string, span) => Self::Field(string.clone(), *span),
|
||||
Literal::Address(string, span, _) => Self::Address(string.clone(), *span),
|
||||
Literal::Boolean(bool, span, _) => Self::Boolean(*bool, *span),
|
||||
Literal::Field(string, span, _) => Self::Field(string.clone(), *span),
|
||||
Literal::Group(group_literal) => Self::Group(group_literal.clone()),
|
||||
Literal::Scalar(string, span) => Self::Scalar(string.clone(), *span),
|
||||
Literal::String(string, span) => Self::String(string.clone(), *span),
|
||||
Literal::Integer(integer_type, string, span) => match integer_type {
|
||||
Literal::Scalar(string, span, _) => Self::Scalar(string.clone(), *span),
|
||||
Literal::String(string, span, _) => Self::String(string.clone(), *span),
|
||||
Literal::Integer(integer_type, string, span, _) => match integer_type {
|
||||
IntegerType::U8 => Self::U8(string.parse()?, *span),
|
||||
IntegerType::U16 => Self::U16(string.parse()?, *span),
|
||||
IntegerType::U32 => Self::U32(string.parse()?, *span),
|
||||
@ -898,23 +898,23 @@ impl From<Value> for Literal {
|
||||
use Value::*;
|
||||
match v {
|
||||
Input(_, _) => todo!("We need to test if this is hittable"),
|
||||
Address(v, span) => Literal::Address(v, span),
|
||||
Boolean(v, span) => Literal::Boolean(v, span),
|
||||
Address(v, span) => Literal::Address(v, span, NodeID::default()),
|
||||
Boolean(v, span) => Literal::Boolean(v, span, NodeID::default()),
|
||||
Struct(_ident, _values) => todo!("We need to test if this is hittable"),
|
||||
Field(v, span) => Literal::Field(v, span),
|
||||
Field(v, span) => Literal::Field(v, span, NodeID::default()),
|
||||
Group(v) => Literal::Group(v),
|
||||
I8(v, span) => Literal::Integer(IntegerType::I8, v.to_string(), span),
|
||||
I16(v, span) => Literal::Integer(IntegerType::I16, v.to_string(), span),
|
||||
I32(v, span) => Literal::Integer(IntegerType::I32, v.to_string(), span),
|
||||
I64(v, span) => Literal::Integer(IntegerType::I64, v.to_string(), span),
|
||||
I128(v, span) => Literal::Integer(IntegerType::I128, v.to_string(), span),
|
||||
U8(v, span) => Literal::Integer(IntegerType::U8, v.to_string(), span),
|
||||
U16(v, span) => Literal::Integer(IntegerType::U16, v.to_string(), span),
|
||||
U32(v, span) => Literal::Integer(IntegerType::U32, v.to_string(), span),
|
||||
U64(v, span) => Literal::Integer(IntegerType::U64, v.to_string(), span),
|
||||
U128(v, span) => Literal::Integer(IntegerType::U128, v.to_string(), span),
|
||||
Scalar(v, span) => Literal::Scalar(v, span),
|
||||
String(v, span) => Literal::String(v, span),
|
||||
I8(v, span) => Literal::Integer(IntegerType::I8, v.to_string(), span, NodeID::default()),
|
||||
I16(v, span) => Literal::Integer(IntegerType::I16, v.to_string(), span, NodeID::default()),
|
||||
I32(v, span) => Literal::Integer(IntegerType::I32, v.to_string(), span, NodeID::default()),
|
||||
I64(v, span) => Literal::Integer(IntegerType::I64, v.to_string(), span, NodeID::default()),
|
||||
I128(v, span) => Literal::Integer(IntegerType::I128, v.to_string(), span, NodeID::default()),
|
||||
U8(v, span) => Literal::Integer(IntegerType::U8, v.to_string(), span, NodeID::default()),
|
||||
U16(v, span) => Literal::Integer(IntegerType::U16, v.to_string(), span, NodeID::default()),
|
||||
U32(v, span) => Literal::Integer(IntegerType::U32, v.to_string(), span, NodeID::default()),
|
||||
U64(v, span) => Literal::Integer(IntegerType::U64, v.to_string(), span, NodeID::default()),
|
||||
U128(v, span) => Literal::Integer(IntegerType::U128, v.to_string(), span, NodeID::default()),
|
||||
Scalar(v, span) => Literal::Scalar(v, span, NodeID::default()),
|
||||
String(v, span) => Literal::String(v, span, NodeID::default()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ impl<'a> ParserContext<'a> {
|
||||
/// At the previous token, return and make an identifier with `name`.
|
||||
fn mk_ident_prev(&self, name: Symbol) -> Identifier {
|
||||
let span = self.prev_token.span;
|
||||
Identifier { name, span }
|
||||
Identifier { name, span, id: NodeID::default() }
|
||||
}
|
||||
|
||||
/// Eats the next token if its an identifier and returns it.
|
||||
|
@ -75,6 +75,7 @@ impl ParserContext<'_> {
|
||||
condition: Box::new(expr),
|
||||
if_true: Box::new(if_true),
|
||||
if_false: Box::new(if_false),
|
||||
id: NodeID::default(),
|
||||
});
|
||||
}
|
||||
Ok(expr)
|
||||
@ -87,6 +88,7 @@ impl ParserContext<'_> {
|
||||
op,
|
||||
left: Box::new(left),
|
||||
right: Box::new(right),
|
||||
id: NodeID::default(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -237,7 +239,7 @@ impl ParserContext<'_> {
|
||||
if self.eat(&Token::As) {
|
||||
let (type_, end_span) = self.parse_primitive_type()?;
|
||||
let span = expr.span() + end_span;
|
||||
expr = Expression::Cast(CastExpression { expression: Box::new(expr), type_, span });
|
||||
expr = Expression::Cast(CastExpression { expression: Box::new(expr), type_, span, id: NodeID::default() });
|
||||
}
|
||||
|
||||
Ok(expr)
|
||||
@ -263,19 +265,20 @@ impl ParserContext<'_> {
|
||||
// If the last operation is a negation and the inner expression is a literal, then construct a negative literal.
|
||||
if let Some((UnaryOperation::Negate, _)) = ops.last() {
|
||||
match inner {
|
||||
Expression::Literal(Literal::Integer(integer_type, string, span)) => {
|
||||
Expression::Literal(Literal::Integer(integer_type, string, span, id)) => {
|
||||
// Remove the negation from the operations.
|
||||
// Note that this unwrap is safe because there is at least one operation in `ops`.
|
||||
let (_, op_span) = ops.pop().unwrap();
|
||||
// Construct a negative integer literal.
|
||||
inner = Expression::Literal(Literal::Integer(integer_type, format!("-{string}"), op_span + span));
|
||||
inner =
|
||||
Expression::Literal(Literal::Integer(integer_type, format!("-{string}"), op_span + span, id));
|
||||
}
|
||||
Expression::Literal(Literal::Field(string, span)) => {
|
||||
Expression::Literal(Literal::Field(string, span, id)) => {
|
||||
// Remove the negation from the operations.
|
||||
// Note that
|
||||
let (_, op_span) = ops.pop().unwrap();
|
||||
// Construct a negative field literal.
|
||||
inner = Expression::Literal(Literal::Field(format!("-{string}"), op_span + span));
|
||||
inner = Expression::Literal(Literal::Field(format!("-{string}"), op_span + span, id));
|
||||
}
|
||||
Expression::Literal(Literal::Group(group_literal)) => {
|
||||
// Remove the negation from the operations.
|
||||
@ -283,17 +286,17 @@ impl ParserContext<'_> {
|
||||
// Construct a negative group literal.
|
||||
// Note that we only handle the case where the group literal is a single integral value.
|
||||
inner = Expression::Literal(Literal::Group(Box::new(match *group_literal {
|
||||
GroupLiteral::Single(string, span) => {
|
||||
GroupLiteral::Single(format!("-{string}"), op_span + span)
|
||||
GroupLiteral::Single(string, span, id) => {
|
||||
GroupLiteral::Single(format!("-{string}"), op_span + span, id)
|
||||
}
|
||||
GroupLiteral::Tuple(tuple) => GroupLiteral::Tuple(tuple),
|
||||
})));
|
||||
}
|
||||
Expression::Literal(Literal::Scalar(string, span)) => {
|
||||
Expression::Literal(Literal::Scalar(string, span, id)) => {
|
||||
// Remove the negation from the operations.
|
||||
let (_, op_span) = ops.pop().unwrap();
|
||||
// Construct a negative scalar literal.
|
||||
inner = Expression::Literal(Literal::Scalar(format!("-{string}"), op_span + span));
|
||||
inner = Expression::Literal(Literal::Scalar(format!("-{string}"), op_span + span, id));
|
||||
}
|
||||
_ => (), // Do nothing.
|
||||
}
|
||||
@ -301,7 +304,12 @@ impl ParserContext<'_> {
|
||||
|
||||
// Apply the operations in reverse order, constructing a unary expression.
|
||||
for (op, op_span) in ops.into_iter().rev() {
|
||||
inner = Expression::Unary(UnaryExpression { span: op_span + inner.span(), op, receiver: Box::new(inner) });
|
||||
inner = Expression::Unary(UnaryExpression {
|
||||
span: op_span + inner.span(),
|
||||
op,
|
||||
receiver: Box::new(inner),
|
||||
id: NodeID::default(),
|
||||
});
|
||||
}
|
||||
|
||||
Ok(inner)
|
||||
@ -317,7 +325,7 @@ impl ParserContext<'_> {
|
||||
|
||||
if let (true, Some(op)) = (args.is_empty(), UnaryOperation::from_symbol(method.name)) {
|
||||
// Found an unary operator and the argument list is empty.
|
||||
Ok(Expression::Unary(UnaryExpression { span, op, receiver: Box::new(receiver) }))
|
||||
Ok(Expression::Unary(UnaryExpression { span, op, receiver: Box::new(receiver), id: NodeID::default() }))
|
||||
} else if let (1, Some(op)) = (args.len(), BinaryOperation::from_symbol(method.name)) {
|
||||
// Found a binary operator and the argument list contains a single argument.
|
||||
Ok(Expression::Binary(BinaryExpression {
|
||||
@ -325,6 +333,7 @@ impl ParserContext<'_> {
|
||||
op,
|
||||
left: Box::new(receiver),
|
||||
right: Box::new(args.swap_remove(0)),
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
} else {
|
||||
// Attempt to parse the method call as a mapping operation.
|
||||
@ -344,12 +353,13 @@ impl ParserContext<'_> {
|
||||
arguments
|
||||
},
|
||||
span,
|
||||
id: NodeID::default(),
|
||||
})))
|
||||
}
|
||||
_ => {
|
||||
// Either an invalid unary/binary operator, or more arguments given.
|
||||
self.emit_err(ParserError::invalid_method_call(receiver, method, args.len(), span));
|
||||
Ok(Expression::Err(ErrExpression { span }))
|
||||
Ok(Expression::Err(ErrExpression { span, id: NodeID::default() }))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -379,6 +389,7 @@ impl ParserContext<'_> {
|
||||
ty: type_,
|
||||
name: member_name,
|
||||
arguments: args,
|
||||
id: NodeID::default(),
|
||||
})
|
||||
} else {
|
||||
// Return the struct constant.
|
||||
@ -386,6 +397,7 @@ impl ParserContext<'_> {
|
||||
span: module_name.span() + member_name.span(),
|
||||
ty: type_,
|
||||
name: member_name,
|
||||
id: NodeID::default(),
|
||||
})
|
||||
}))
|
||||
}
|
||||
@ -409,8 +421,12 @@ impl ParserContext<'_> {
|
||||
if self.check_int() {
|
||||
// Eat a tuple member access.
|
||||
let (index, span) = self.eat_integer()?;
|
||||
expr =
|
||||
Expression::Access(AccessExpression::Tuple(TupleAccess { tuple: Box::new(expr), index, span }))
|
||||
expr = Expression::Access(AccessExpression::Tuple(TupleAccess {
|
||||
tuple: Box::new(expr),
|
||||
index,
|
||||
span,
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
} else if self.eat(&Token::Leo) {
|
||||
// Eat an external function call.
|
||||
self.eat(&Token::Div); // todo: Make `/` a more general token.
|
||||
@ -425,6 +441,7 @@ impl ParserContext<'_> {
|
||||
function: Box::new(Expression::Identifier(name)),
|
||||
external: Some(Box::new(expr)),
|
||||
arguments,
|
||||
id: NodeID::default(),
|
||||
});
|
||||
} else {
|
||||
// Parse identifier name.
|
||||
@ -439,6 +456,7 @@ impl ParserContext<'_> {
|
||||
span: expr.span() + name.span(),
|
||||
inner: Box::new(expr),
|
||||
name,
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
}
|
||||
}
|
||||
@ -457,6 +475,7 @@ impl ParserContext<'_> {
|
||||
function: Box::new(expr),
|
||||
external: None,
|
||||
arguments,
|
||||
id: NodeID::default(),
|
||||
});
|
||||
}
|
||||
// Check if next token is a dot to see if we are calling recursive method.
|
||||
@ -478,7 +497,7 @@ impl ParserContext<'_> {
|
||||
|
||||
match elements.len() {
|
||||
// If the tuple expression is empty, return a `UnitExpression`.
|
||||
0 => Ok(Expression::Unit(UnitExpression { span })),
|
||||
0 => Ok(Expression::Unit(UnitExpression { span, id: NodeID::default() })),
|
||||
1 => match trailing {
|
||||
// If there is one element in the tuple but no trailing comma, e.g `(foo)`, return the element.
|
||||
false => Ok(elements.swap_remove(0)),
|
||||
@ -487,7 +506,7 @@ impl ParserContext<'_> {
|
||||
},
|
||||
// Otherwise, return a tuple expression.
|
||||
// Note: This is the only place where `TupleExpression` is constructed in the parser.
|
||||
_ => Ok(Expression::Tuple(TupleExpression { elements, span })),
|
||||
_ => Ok(Expression::Tuple(TupleExpression { elements, span, id: NodeID::default() })),
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,7 +554,7 @@ impl ParserContext<'_> {
|
||||
let end_span = check_ahead(dist, &Token::Group)?;
|
||||
dist += 1; // Standing at `)` so advance one for 'group'.
|
||||
|
||||
let gt = GroupTuple { span: start_span + &end_span, x: first_gc, y: second_gc };
|
||||
let gt = GroupTuple { span: start_span + &end_span, x: first_gc, y: second_gc, id: NodeID::default() };
|
||||
|
||||
// Eat everything so that this isn't just peeking.
|
||||
for _ in 0..dist {
|
||||
@ -558,14 +577,16 @@ impl ParserContext<'_> {
|
||||
self.expect_identifier()?
|
||||
};
|
||||
|
||||
let expression = if self.eat(&Token::Colon) {
|
||||
let (expression, span) = if self.eat(&Token::Colon) {
|
||||
// Parse individual struct variable declarations.
|
||||
Some(self.parse_expression()?)
|
||||
let expression = self.parse_expression()?;
|
||||
let span = identifier.span + expression.span();
|
||||
(Some(expression), span)
|
||||
} else {
|
||||
None
|
||||
(None, identifier.span)
|
||||
};
|
||||
|
||||
Ok(StructVariableInitializer { identifier, expression })
|
||||
Ok(StructVariableInitializer { identifier, expression, id: NodeID::default(), span })
|
||||
}
|
||||
|
||||
/// Returns an [`Expression`] AST node if the next tokens represent a
|
||||
@ -575,7 +596,12 @@ impl ParserContext<'_> {
|
||||
let (members, _, end) =
|
||||
self.parse_list(Delimiter::Brace, Some(Token::Comma), |p| p.parse_struct_member().map(Some))?;
|
||||
|
||||
Ok(Expression::Struct(StructExpression { span: identifier.span + end, name: identifier, members }))
|
||||
Ok(Expression::Struct(StructExpression {
|
||||
span: identifier.span + end,
|
||||
name: identifier,
|
||||
members,
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
}
|
||||
|
||||
/// Returns an [`Expression`] AST node if the next token is a primary expression:
|
||||
@ -602,38 +628,42 @@ impl ParserContext<'_> {
|
||||
// Literal followed by `field`, e.g., `42field`.
|
||||
Some(Token::Field) => {
|
||||
assert_no_whitespace("field")?;
|
||||
Expression::Literal(Literal::Field(value, full_span))
|
||||
Expression::Literal(Literal::Field(value, full_span, NodeID::default()))
|
||||
}
|
||||
// Literal followed by `group`, e.g., `42group`.
|
||||
Some(Token::Group) => {
|
||||
assert_no_whitespace("group")?;
|
||||
Expression::Literal(Literal::Group(Box::new(GroupLiteral::Single(value, full_span))))
|
||||
Expression::Literal(Literal::Group(Box::new(GroupLiteral::Single(
|
||||
value,
|
||||
full_span,
|
||||
NodeID::default(),
|
||||
))))
|
||||
}
|
||||
// Literal followed by `scalar` e.g., `42scalar`.
|
||||
Some(Token::Scalar) => {
|
||||
assert_no_whitespace("scalar")?;
|
||||
Expression::Literal(Literal::Scalar(value, full_span))
|
||||
Expression::Literal(Literal::Scalar(value, full_span, NodeID::default()))
|
||||
}
|
||||
// Literal followed by other type suffix, e.g., `42u8`.
|
||||
Some(suffix) => {
|
||||
assert_no_whitespace(&suffix.to_string())?;
|
||||
let int_ty = Self::token_to_int_type(suffix).expect("unknown int type token");
|
||||
Expression::Literal(Literal::Integer(int_ty, value, full_span))
|
||||
Expression::Literal(Literal::Integer(int_ty, value, full_span, NodeID::default()))
|
||||
}
|
||||
None => return Err(ParserError::implicit_values_not_allowed(value, span).into()),
|
||||
}
|
||||
}
|
||||
Token::True => Expression::Literal(Literal::Boolean(true, span)),
|
||||
Token::False => Expression::Literal(Literal::Boolean(false, span)),
|
||||
Token::True => Expression::Literal(Literal::Boolean(true, span, NodeID::default())),
|
||||
Token::False => Expression::Literal(Literal::Boolean(false, span, NodeID::default())),
|
||||
Token::AddressLit(address_string) => {
|
||||
if address_string.parse::<Address<Testnet3>>().is_err() {
|
||||
self.emit_err(ParserError::invalid_address_lit(&address_string, span));
|
||||
}
|
||||
Expression::Literal(Literal::Address(address_string, span))
|
||||
Expression::Literal(Literal::Address(address_string, span, NodeID::default()))
|
||||
}
|
||||
Token::StaticString(value) => Expression::Literal(Literal::String(value, span)),
|
||||
Token::StaticString(value) => Expression::Literal(Literal::String(value, span, NodeID::default())),
|
||||
Token::Identifier(name) => {
|
||||
let ident = Identifier { name, span };
|
||||
let ident = Identifier { name, span, id: NodeID::default() };
|
||||
if !self.disallow_struct_construction && self.check(&Token::LeftCurly) {
|
||||
// Parse struct and records inits as struct expressions.
|
||||
// Enforce struct or record type later at type checking.
|
||||
@ -642,10 +672,12 @@ impl ParserContext<'_> {
|
||||
Expression::Identifier(ident)
|
||||
}
|
||||
}
|
||||
Token::SelfLower => Expression::Identifier(Identifier { name: sym::SelfLower, span }),
|
||||
Token::Block => Expression::Identifier(Identifier { name: sym::block, span }),
|
||||
Token::SelfLower => {
|
||||
Expression::Identifier(Identifier { name: sym::SelfLower, span, id: NodeID::default() })
|
||||
}
|
||||
Token::Block => Expression::Identifier(Identifier { name: sym::block, span, id: NodeID::default() }),
|
||||
t if crate::type_::TYPE_TOKENS.contains(&t) => {
|
||||
Expression::Identifier(Identifier { name: t.keyword_to_symbol().unwrap(), span })
|
||||
Expression::Identifier(Identifier { name: t.keyword_to_symbol().unwrap(), span, id: NodeID::default() })
|
||||
}
|
||||
token => {
|
||||
return Err(ParserError::unexpected_str(token, "expression", span).into());
|
||||
|
@ -223,7 +223,7 @@ impl ParserContext<'_> {
|
||||
|
||||
let (identifier, type_, span) = self.parse_typed_ident()?;
|
||||
|
||||
Ok(Member { mode, identifier, type_, span })
|
||||
Ok(Member { mode, identifier, type_, span, id: NodeID::default() })
|
||||
}
|
||||
|
||||
/// Parses a struct or record definition, e.g., `struct Foo { ... }` or `record Foo { ... }`.
|
||||
@ -235,7 +235,13 @@ impl ParserContext<'_> {
|
||||
self.expect(&Token::LeftCurly)?;
|
||||
let (members, end) = self.parse_struct_members()?;
|
||||
|
||||
Ok((struct_name.name, Struct { identifier: struct_name, members, is_record, span: start + end }))
|
||||
Ok((struct_name.name, Struct {
|
||||
identifier: struct_name,
|
||||
members,
|
||||
is_record,
|
||||
span: start + end,
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
}
|
||||
|
||||
/// Parses a mapping declaration, e.g. `mapping balances: address => u128`.
|
||||
@ -247,7 +253,7 @@ impl ParserContext<'_> {
|
||||
self.expect(&Token::BigArrow)?;
|
||||
let (value_type, _) = self.parse_type()?;
|
||||
let end = self.expect(&Token::Semicolon)?;
|
||||
Ok((identifier.name, Mapping { identifier, key_type, value_type, span: start + end }))
|
||||
Ok((identifier.name, Mapping { identifier, key_type, value_type, span: start + end, id: NodeID::default() }))
|
||||
}
|
||||
|
||||
// TODO: Return a span associated with the mode.
|
||||
@ -298,11 +304,23 @@ impl ParserContext<'_> {
|
||||
self.eat(&Token::Record);
|
||||
span = span + self.prev_token.span;
|
||||
|
||||
Ok(functions::Input::External(External { identifier: name, program_name: external, record, span }))
|
||||
Ok(functions::Input::External(External {
|
||||
identifier: name,
|
||||
program_name: external,
|
||||
record,
|
||||
span,
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
} else {
|
||||
let type_ = self.parse_type()?.0;
|
||||
|
||||
Ok(functions::Input::Internal(FunctionInput { identifier: name, mode, type_, span: name.span }))
|
||||
Ok(functions::Input::Internal(FunctionInput {
|
||||
identifier: name,
|
||||
mode,
|
||||
type_,
|
||||
span: name.span,
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,7 +329,7 @@ impl ParserContext<'_> {
|
||||
// TODO: Could this span be made more accurate?
|
||||
let mode = self.parse_mode()?;
|
||||
let (type_, span) = self.parse_type()?;
|
||||
Ok(FunctionOutput { mode, type_, span })
|
||||
Ok(FunctionOutput { mode, type_, span, id: NodeID::default() })
|
||||
}
|
||||
|
||||
/// Returns a [`Output`] AST node if the next tokens represent a function output.
|
||||
@ -338,6 +356,7 @@ impl ParserContext<'_> {
|
||||
program_name: external,
|
||||
record,
|
||||
span,
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
} else {
|
||||
Ok(Output::Internal(self.parse_function_output()?))
|
||||
@ -353,7 +372,9 @@ impl ParserContext<'_> {
|
||||
// Parse the `@` symbol and identifier.
|
||||
let start = self.expect(&Token::At)?;
|
||||
let identifier = match self.token.token {
|
||||
Token::Program => Identifier { name: sym::program, span: self.expect(&Token::Program)? },
|
||||
Token::Program => {
|
||||
Identifier { name: sym::program, span: self.expect(&Token::Program)?, id: NodeID::default() }
|
||||
}
|
||||
_ => self.expect_identifier()?,
|
||||
};
|
||||
let span = start + identifier.span;
|
||||
@ -362,7 +383,7 @@ impl ParserContext<'_> {
|
||||
// Check that there is no whitespace in between the `@` symbol and identifier.
|
||||
match identifier.span.hi.0 - start.lo.0 > 1 + identifier.name.to_string().len() as u32 {
|
||||
true => Err(ParserError::space_in_annotation(span).into()),
|
||||
false => Ok(Annotation { identifier, span }),
|
||||
false => Ok(Annotation { identifier, span, id: NodeID::default() }),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ impl ParserContext<'_> {
|
||||
self.expect(&Token::Semicolon)?;
|
||||
|
||||
// Return the assertion statement.
|
||||
Ok(Statement::Assert(AssertStatement { variant, span }))
|
||||
Ok(Statement::Assert(AssertStatement { variant, span, id: NodeID::default() }))
|
||||
}
|
||||
|
||||
/// Returns a [`AssignStatement`] AST node if the next tokens represent a assign, otherwise expects an expression statement.
|
||||
@ -124,10 +124,11 @@ impl ParserContext<'_> {
|
||||
right: Box::new(value),
|
||||
op,
|
||||
span,
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
};
|
||||
|
||||
Ok(Statement::Assign(Box::new(AssignStatement { span, place, value })))
|
||||
Ok(Statement::Assign(Box::new(AssignStatement { span, place, value, id: NodeID::default() })))
|
||||
} else {
|
||||
// Check for `increment` and `decrement` statements. If found, emit a deprecation warning.
|
||||
if let Expression::Call(call_expression) = &place {
|
||||
@ -152,14 +153,21 @@ impl ParserContext<'_> {
|
||||
|
||||
// Parse the expression as a statement.
|
||||
let end = self.expect(&Token::Semicolon)?;
|
||||
Ok(Statement::Expression(ExpressionStatement { span: place.span() + end, expression: place }))
|
||||
Ok(Statement::Expression(ExpressionStatement {
|
||||
span: place.span() + end,
|
||||
expression: place,
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a [`Block`] AST node if the next tokens represent a block of statements.
|
||||
pub(super) fn parse_block(&mut self) -> Result<Block> {
|
||||
self.parse_list(Delimiter::Brace, None, |p| p.parse_statement().map(Some))
|
||||
.map(|(statements, _, span)| Block { statements, span })
|
||||
self.parse_list(Delimiter::Brace, None, |p| p.parse_statement().map(Some)).map(|(statements, _, span)| Block {
|
||||
statements,
|
||||
span,
|
||||
id: NodeID::default(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns a [`ReturnStatement`] AST node if the next tokens represent a return statement.
|
||||
@ -168,7 +176,9 @@ impl ParserContext<'_> {
|
||||
|
||||
let expression = match self.token.token {
|
||||
// If the next token is a semicolon, implicitly return a unit expression, `()`.
|
||||
Token::Semicolon | Token::Then => Expression::Unit(UnitExpression { span: self.token.span }),
|
||||
Token::Semicolon | Token::Then => {
|
||||
Expression::Unit(UnitExpression { span: self.token.span, id: NodeID::default() })
|
||||
}
|
||||
// Otherwise, attempt to parse an expression.
|
||||
_ => self.parse_expression()?,
|
||||
};
|
||||
@ -190,7 +200,7 @@ impl ParserContext<'_> {
|
||||
};
|
||||
let end = self.expect(&Token::Semicolon)?;
|
||||
let span = start + end;
|
||||
Ok(ReturnStatement { span, expression, finalize_arguments: finalize_args })
|
||||
Ok(ReturnStatement { span, expression, finalize_arguments: finalize_args, id: NodeID::default() })
|
||||
}
|
||||
|
||||
/// Returns a [`ConditionalStatement`] AST node if the next tokens represent a conditional statement.
|
||||
@ -215,6 +225,7 @@ impl ParserContext<'_> {
|
||||
condition: expr,
|
||||
then: body,
|
||||
otherwise: next,
|
||||
id: NodeID::default(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -245,6 +256,7 @@ impl ParserContext<'_> {
|
||||
stop_value: Default::default(),
|
||||
inclusive: false,
|
||||
block,
|
||||
id: NodeID::default(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -286,13 +298,16 @@ impl ParserContext<'_> {
|
||||
));
|
||||
(
|
||||
Default::default(),
|
||||
ConsoleFunction::Assert(Expression::Err(ErrExpression { span: Default::default() })),
|
||||
ConsoleFunction::Assert(Expression::Err(ErrExpression {
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
})),
|
||||
)
|
||||
}
|
||||
};
|
||||
self.expect(&Token::Semicolon)?;
|
||||
|
||||
Ok(ConsoleStatement { span: keyword + span, function })
|
||||
Ok(ConsoleStatement { span: keyword + span, function, id: NodeID::default() })
|
||||
}
|
||||
|
||||
/// Returns a [`DefinitionStatement`] AST node if the next tokens represent a definition statement.
|
||||
@ -314,6 +329,13 @@ impl ParserContext<'_> {
|
||||
let value = self.parse_expression()?;
|
||||
self.expect(&Token::Semicolon)?;
|
||||
|
||||
Ok(DefinitionStatement { span: decl_span + value.span(), declaration_type: decl_type, place, type_, value })
|
||||
Ok(DefinitionStatement {
|
||||
span: decl_span + value.span(),
|
||||
declaration_type: decl_type,
|
||||
place,
|
||||
type_,
|
||||
value,
|
||||
id: NodeID::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_ast::{AssignStatement, Expression, Identifier, Statement};
|
||||
use leo_ast::{AssignStatement, Expression, Identifier, NodeID, Statement};
|
||||
use leo_span::Symbol;
|
||||
use std::fmt::Display;
|
||||
|
||||
@ -39,6 +39,7 @@ impl Assigner {
|
||||
place: Expression::Identifier(identifier),
|
||||
value,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
}
|
||||
|
||||
@ -48,7 +49,7 @@ impl Assigner {
|
||||
// Create a new variable for the expression.
|
||||
let name = self.unique_symbol("$var", "$");
|
||||
|
||||
let place = Identifier { name, span: Default::default() };
|
||||
let place = Identifier { name, span: Default::default(), id: NodeID::default() };
|
||||
|
||||
(place, self.simple_assign_statement(place, expr))
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ use leo_ast::{
|
||||
ExpressionReconstructor,
|
||||
Identifier,
|
||||
MemberAccess,
|
||||
NodeID,
|
||||
StructExpression,
|
||||
StructVariableInitializer,
|
||||
TupleAccess,
|
||||
@ -57,6 +58,7 @@ impl ExpressionReconstructor for DeadCodeEliminator {
|
||||
.map(|arg| self.reconstruct_expression(arg).0)
|
||||
.collect(),
|
||||
span: function.span,
|
||||
id: NodeID::default(),
|
||||
});
|
||||
// Unset `self.is_necessary`.
|
||||
self.is_necessary = false;
|
||||
@ -66,11 +68,13 @@ impl ExpressionReconstructor for DeadCodeEliminator {
|
||||
inner: Box::new(self.reconstruct_expression(*member.inner).0),
|
||||
name: member.name,
|
||||
span: member.span,
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
AccessExpression::Tuple(tuple) => AccessExpression::Tuple(TupleAccess {
|
||||
tuple: Box::new(self.reconstruct_expression(*tuple.tuple).0),
|
||||
index: tuple.index,
|
||||
span: tuple.span,
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
AccessExpression::AssociatedConstant(constant) => AccessExpression::AssociatedConstant(constant),
|
||||
}),
|
||||
@ -94,9 +98,12 @@ impl ExpressionReconstructor for DeadCodeEliminator {
|
||||
Some(expression) => Some(self.reconstruct_expression(expression).0),
|
||||
None => unreachable!("Static single assignment ensures that the expression always exists."),
|
||||
},
|
||||
span: member.span,
|
||||
id: NodeID::default(),
|
||||
})
|
||||
.collect(),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
use crate::DeadCodeEliminator;
|
||||
|
||||
use leo_ast::{Finalize, Function, ProgramReconstructor, StatementReconstructor};
|
||||
use leo_ast::{Finalize, Function, NodeID, ProgramReconstructor, StatementReconstructor};
|
||||
|
||||
impl ProgramReconstructor for DeadCodeEliminator {
|
||||
fn reconstruct_function(&mut self, input: Function) -> Function {
|
||||
@ -43,6 +43,7 @@ impl ProgramReconstructor for DeadCodeEliminator {
|
||||
output_type: finalize.output_type,
|
||||
block,
|
||||
span: finalize.span,
|
||||
id: NodeID::default(),
|
||||
}
|
||||
});
|
||||
|
||||
@ -56,6 +57,7 @@ impl ProgramReconstructor for DeadCodeEliminator {
|
||||
block,
|
||||
finalize,
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ use leo_ast::{
|
||||
ExpressionReconstructor,
|
||||
ExpressionStatement,
|
||||
IterationStatement,
|
||||
NodeID,
|
||||
ReturnStatement,
|
||||
Statement,
|
||||
StatementReconstructor,
|
||||
@ -51,6 +52,7 @@ impl StatementReconstructor for DeadCodeEliminator {
|
||||
}
|
||||
},
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
});
|
||||
|
||||
// Unset the `is_necessary` flag.
|
||||
@ -90,6 +92,7 @@ impl StatementReconstructor for DeadCodeEliminator {
|
||||
place: input.place,
|
||||
value: self.reconstruct_expression(input.value).0,
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
|
||||
// Unset the `is_necessary` flag.
|
||||
@ -111,7 +114,7 @@ impl StatementReconstructor for DeadCodeEliminator {
|
||||
// Reverse the direction of `statements`.
|
||||
statements.reverse();
|
||||
|
||||
(Block { statements, span: block.span }, Default::default())
|
||||
(Block { statements, span: block.span, id: NodeID::default() }, Default::default())
|
||||
}
|
||||
|
||||
/// Flattening removes conditional statements from the program.
|
||||
@ -142,6 +145,7 @@ impl StatementReconstructor for DeadCodeEliminator {
|
||||
let statement = Statement::Expression(ExpressionStatement {
|
||||
expression: self.reconstruct_call(expression).0,
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
});
|
||||
|
||||
// Unset the `is_necessary` flag.
|
||||
@ -157,6 +161,7 @@ impl StatementReconstructor for DeadCodeEliminator {
|
||||
.reconstruct_access(AccessExpression::AssociatedFunction(associated_function))
|
||||
.0,
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -183,6 +188,7 @@ impl StatementReconstructor for DeadCodeEliminator {
|
||||
arguments.into_iter().map(|argument| self.reconstruct_expression(argument).0).collect()
|
||||
}),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
});
|
||||
|
||||
// Unset the `is_necessary` flag.
|
||||
|
@ -24,6 +24,7 @@ use leo_ast::{
|
||||
ExpressionReconstructor,
|
||||
Member,
|
||||
MemberAccess,
|
||||
NodeID,
|
||||
Statement,
|
||||
StructExpression,
|
||||
StructVariableInitializer,
|
||||
@ -51,12 +52,14 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
.map(|arg| self.reconstruct_expression(arg).0)
|
||||
.collect(),
|
||||
span: function.span,
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
}
|
||||
AccessExpression::Member(member) => Expression::Access(AccessExpression::Member(MemberAccess {
|
||||
inner: Box::new(self.reconstruct_expression(*member.inner).0),
|
||||
name: member.name,
|
||||
span: member.span,
|
||||
id: NodeID::default(),
|
||||
})),
|
||||
AccessExpression::Tuple(tuple) => {
|
||||
// Reconstruct the tuple expression.
|
||||
@ -92,10 +95,18 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
// Accumulate any statements produced.
|
||||
statements.extend(stmts);
|
||||
// Accumulate the struct members.
|
||||
members.push(StructVariableInitializer { identifier: member.identifier, expression: Some(expr) });
|
||||
members.push(StructVariableInitializer {
|
||||
identifier: member.identifier,
|
||||
expression: Some(expr),
|
||||
span: member.span,
|
||||
id: NodeID::default(),
|
||||
});
|
||||
}
|
||||
|
||||
(Expression::Struct(StructExpression { name: input.name, members, span: input.span }), statements)
|
||||
(
|
||||
Expression::Struct(StructExpression { name: input.name, members, span: input.span, id: NodeID::default() }),
|
||||
statements,
|
||||
)
|
||||
}
|
||||
|
||||
/// Reconstructs ternary expressions over tuples and structs, accumulating any statements that are generated.
|
||||
@ -139,6 +150,7 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
if_true: Box::new(if_true),
|
||||
if_false: Box::new(if_false),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
});
|
||||
|
||||
// Accumulate any statements generated.
|
||||
@ -153,6 +165,7 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
})
|
||||
.collect(),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
});
|
||||
(tuple, statements)
|
||||
}
|
||||
@ -187,13 +200,16 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
inner: Box::new(Expression::Access(AccessExpression::Member(first.clone()))),
|
||||
name: *identifier,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}))),
|
||||
if_false: Box::new(Expression::Access(AccessExpression::Member(MemberAccess {
|
||||
inner: Box::new(Expression::Access(AccessExpression::Member(second.clone()))),
|
||||
name: *identifier,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}))),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
});
|
||||
|
||||
// Accumulate any statements generated.
|
||||
@ -206,6 +222,8 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
StructVariableInitializer {
|
||||
identifier: *identifier,
|
||||
expression: Some(Expression::Identifier(result)),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
@ -214,6 +232,7 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
name: first_member_struct.identifier,
|
||||
members,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
});
|
||||
|
||||
// Accumulate any statements generated.
|
||||
@ -246,6 +265,7 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
if_true: Box::new(if_true),
|
||||
if_false: Box::new(if_false),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
|
||||
// Accumulate the new assignment statement.
|
||||
@ -276,13 +296,16 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
inner: Box::new(Expression::Identifier(first)),
|
||||
name: *identifier,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}))),
|
||||
if_false: Box::new(Expression::Access(AccessExpression::Member(MemberAccess {
|
||||
inner: Box::new(Expression::Identifier(second)),
|
||||
name: *identifier,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}))),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
});
|
||||
|
||||
// Accumulate any statements generated.
|
||||
@ -295,6 +318,8 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
StructVariableInitializer {
|
||||
identifier: *identifier,
|
||||
expression: Some(Expression::Identifier(result)),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
@ -303,6 +328,7 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
name: first_struct.identifier,
|
||||
members,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
});
|
||||
|
||||
// Accumulate any statements generated.
|
||||
@ -332,6 +358,7 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
if_true: Box::new(Expression::Tuple(first_tuple.clone())),
|
||||
if_false: Box::new(Expression::Tuple(second_tuple.clone())),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
})
|
||||
}
|
||||
// Otherwise, create a new intermediate assignment for the ternary expression are return the assigned variable.
|
||||
@ -351,6 +378,7 @@ impl ExpressionReconstructor for Flattener<'_> {
|
||||
if_true: Box::new(if_true),
|
||||
if_false: Box::new(if_false),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
|
||||
// Accumulate the new assignment statement.
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
use crate::Flattener;
|
||||
|
||||
use leo_ast::{Finalize, Function, ProgramReconstructor, StatementReconstructor, Type};
|
||||
use leo_ast::{Finalize, Function, NodeID, ProgramReconstructor, StatementReconstructor, Type};
|
||||
|
||||
impl ProgramReconstructor for Flattener<'_> {
|
||||
/// Flattens a function's body and finalize block, if it exists.
|
||||
@ -47,6 +47,7 @@ impl ProgramReconstructor for Flattener<'_> {
|
||||
output_type: finalize.output_type,
|
||||
block,
|
||||
span: finalize.span,
|
||||
id: NodeID::default(),
|
||||
}
|
||||
});
|
||||
|
||||
@ -77,6 +78,7 @@ impl ProgramReconstructor for Flattener<'_> {
|
||||
block,
|
||||
finalize,
|
||||
span: function.span,
|
||||
id: NodeID::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ use leo_ast::{
|
||||
Identifier,
|
||||
IterationStatement,
|
||||
Node,
|
||||
NodeID,
|
||||
ReturnStatement,
|
||||
Statement,
|
||||
StatementReconstructor,
|
||||
@ -69,6 +70,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
// Flatten the arguments of the assert statement.
|
||||
let assert = AssertStatement {
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
variant: match input.variant {
|
||||
AssertVariant::Assert(expression) => {
|
||||
let (expression, additional_statements) = self.reconstruct_expression(expression);
|
||||
@ -102,15 +104,18 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
Some(guard) => (
|
||||
Statement::Assert(AssertStatement {
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
variant: AssertVariant::Assert(Expression::Binary(BinaryExpression {
|
||||
op: BinaryOperation::Or,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
// Take the logical negation of the guard.
|
||||
left: Box::new(Expression::Unary(UnaryExpression {
|
||||
op: UnaryOperation::Not,
|
||||
receiver: Box::new(guard),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
})),
|
||||
op: BinaryOperation::Or,
|
||||
span: Default::default(),
|
||||
right: Box::new(match assert.variant {
|
||||
// If the assert statement is an `assert`, use the expression as is.
|
||||
AssertVariant::Assert(expression) => expression,
|
||||
@ -120,6 +125,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
op: BinaryOperation::Eq,
|
||||
right: Box::new(right),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
// If the assert statement is an `assert_ne`, construct a new inequality expression.
|
||||
AssertVariant::AssertNeq(left, right) => Expression::Binary(BinaryExpression {
|
||||
@ -127,6 +133,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
op: BinaryOperation::Neq,
|
||||
right: Box::new(right),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
}),
|
||||
})),
|
||||
@ -191,6 +198,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
})
|
||||
.collect(),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
};
|
||||
// Add the `tuple_expression` to `self.tuples`.
|
||||
self.tuples.insert(lhs_identifier.name, tuple_expression.clone());
|
||||
@ -200,6 +208,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
place: Expression::Tuple(tuple_expression),
|
||||
value: Expression::Call(call),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
})),
|
||||
statements,
|
||||
)
|
||||
@ -215,6 +224,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
place: Expression::Identifier(lhs_identifier),
|
||||
value: Expression::Call(call),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
})),
|
||||
statements,
|
||||
)
|
||||
@ -264,6 +274,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
place: Expression::Identifier(lhs_identifier),
|
||||
value,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
})),
|
||||
statements,
|
||||
)
|
||||
@ -304,6 +315,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
place: Expression::Tuple(tuple),
|
||||
value: Expression::Call(call),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
})),
|
||||
statements,
|
||||
)
|
||||
@ -321,6 +333,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
place: lhs,
|
||||
value: rhs,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
},
|
||||
));
|
||||
@ -345,6 +358,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
place: lhs,
|
||||
value: rhs,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
})));
|
||||
}
|
||||
(Statement::dummy(Default::default()), statements)
|
||||
@ -374,7 +388,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
statements.push(reconstructed_statement);
|
||||
}
|
||||
|
||||
(Block { span: block.span, statements }, Default::default())
|
||||
(Block { span: block.span, statements, id: NodeID::default() }, Default::default())
|
||||
}
|
||||
|
||||
/// Flatten a conditional statement into a list of statements.
|
||||
@ -397,6 +411,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
op: UnaryOperation::Not,
|
||||
receiver: Box::new(conditional.condition.clone()),
|
||||
span: conditional.condition.span(),
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
|
||||
// Reconstruct the otherwise-block and accumulate it constituent statements.
|
||||
@ -443,6 +458,7 @@ impl StatementReconstructor for Flattener<'_> {
|
||||
span: input.span,
|
||||
expression: Expression::Tuple(tuple),
|
||||
finalize_arguments: input.finalize_arguments,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
}
|
||||
// Otherwise, add the expression directly.
|
||||
|
@ -25,6 +25,7 @@ use leo_ast::{
|
||||
ExpressionReconstructor,
|
||||
Identifier,
|
||||
Member,
|
||||
NodeID,
|
||||
ReturnStatement,
|
||||
Statement,
|
||||
TernaryExpression,
|
||||
@ -82,6 +83,7 @@ impl<'a> Flattener<'a> {
|
||||
left: Box::new(acc),
|
||||
right: Box::new(condition),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
})
|
||||
}))
|
||||
}
|
||||
@ -109,13 +111,17 @@ impl<'a> Flattener<'a> {
|
||||
// Helper to construct and store ternary assignments. e.g `$ret$0 = $var$0 ? $var$1 : $var$2`
|
||||
let mut construct_ternary_assignment =
|
||||
|guard: Expression, if_true: Expression, if_false: Expression| {
|
||||
let place =
|
||||
Identifier { name: self.assigner.unique_symbol(prefix, "$"), span: Default::default() };
|
||||
let place = Identifier {
|
||||
name: self.assigner.unique_symbol(prefix, "$"),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
};
|
||||
let (value, stmts) = self.reconstruct_ternary(TernaryExpression {
|
||||
condition: Box::new(guard),
|
||||
if_true: Box::new(if_true),
|
||||
if_false: Box::new(if_false),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
});
|
||||
statements.extend(stmts);
|
||||
|
||||
@ -248,6 +254,7 @@ impl<'a> Flattener<'a> {
|
||||
expression,
|
||||
finalize_arguments,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ use leo_ast::{
|
||||
ExpressionReconstructor,
|
||||
Identifier,
|
||||
IterationStatement,
|
||||
NodeID,
|
||||
ProgramReconstructor,
|
||||
Statement,
|
||||
StatementReconstructor,
|
||||
@ -79,7 +80,7 @@ impl ExpressionReconstructor for AssignmentRenamer {
|
||||
false => *self.rename_table.lookup(input.name).unwrap_or(&input.name),
|
||||
};
|
||||
|
||||
(Expression::Identifier(Identifier { name, span: input.span }), Default::default())
|
||||
(Expression::Identifier(Identifier { name, span: input.span, id: NodeID::default() }), Default::default())
|
||||
}
|
||||
|
||||
/// Rename the variable initializers in the struct expression.
|
||||
@ -98,9 +99,12 @@ impl ExpressionReconstructor for AssignmentRenamer {
|
||||
"SSA guarantees that all struct members are always of the form `<id> : <expr>`."
|
||||
),
|
||||
},
|
||||
span: member.span,
|
||||
id: NodeID::default(),
|
||||
})
|
||||
.collect(),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
Default::default(),
|
||||
)
|
||||
@ -119,7 +123,10 @@ impl StatementReconstructor for AssignmentRenamer {
|
||||
let place = self.reconstruct_expression(input.place).0;
|
||||
self.is_lhs = false;
|
||||
|
||||
(Statement::Assign(Box::new(AssignStatement { place, value, span: input.span })), Default::default())
|
||||
(
|
||||
Statement::Assign(Box::new(AssignStatement { place, value, span: input.span, id: NodeID::default() })),
|
||||
Default::default(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Flattening removes conditional statements from the program.
|
||||
|
@ -21,6 +21,7 @@ use leo_ast::{
|
||||
Expression,
|
||||
ExpressionReconstructor,
|
||||
Identifier,
|
||||
NodeID,
|
||||
ReturnStatement,
|
||||
Statement,
|
||||
StatementReconstructor,
|
||||
@ -89,7 +90,7 @@ impl ExpressionReconstructor for FunctionInliner<'_> {
|
||||
_ => unreachable!("This branch checks that the last statement is a return statement."),
|
||||
}
|
||||
}
|
||||
_ => Expression::Unit(UnitExpression { span: Default::default() }),
|
||||
_ => Expression::Unit(UnitExpression { span: Default::default(), id: NodeID::default() }),
|
||||
};
|
||||
|
||||
(result, inlined_statements)
|
||||
|
@ -26,6 +26,7 @@ use leo_ast::{
|
||||
ExpressionReconstructor,
|
||||
ExpressionStatement,
|
||||
IterationStatement,
|
||||
NodeID,
|
||||
Statement,
|
||||
StatementReconstructor,
|
||||
};
|
||||
@ -39,14 +40,20 @@ impl StatementReconstructor for FunctionInliner<'_> {
|
||||
// If the function call produces a tuple, we need to segment the tuple into multiple assignment statements.
|
||||
(Expression::Tuple(left), Expression::Tuple(right)) if left.elements.len() == right.elements.len() => {
|
||||
statements.extend(left.elements.into_iter().zip(right.elements.into_iter()).map(|(lhs, rhs)| {
|
||||
Statement::Assign(Box::new(AssignStatement { place: lhs, value: rhs, span: Default::default() }))
|
||||
Statement::Assign(Box::new(AssignStatement {
|
||||
place: lhs,
|
||||
value: rhs,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
}));
|
||||
(Statement::dummy(Default::default()), statements)
|
||||
}
|
||||
|
||||
(place, value) => {
|
||||
(Statement::Assign(Box::new(AssignStatement { place, value, span: input.span })), statements)
|
||||
}
|
||||
(place, value) => (
|
||||
Statement::Assign(Box::new(AssignStatement { place, value, span: input.span, id: NodeID::default() })),
|
||||
statements,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +67,7 @@ impl StatementReconstructor for FunctionInliner<'_> {
|
||||
statements.push(reconstructed_statement);
|
||||
}
|
||||
|
||||
(Block { span: block.span, statements }, Default::default())
|
||||
(Block { span: block.span, statements, id: NodeID::default() }, Default::default())
|
||||
}
|
||||
|
||||
/// Flattening removes conditional statements from the program.
|
||||
@ -87,7 +94,7 @@ impl StatementReconstructor for FunctionInliner<'_> {
|
||||
// If the resulting expression is a unit expression, return a dummy statement.
|
||||
let statement = match expression {
|
||||
Expression::Unit(_) => Statement::dummy(Default::default()),
|
||||
_ => Statement::Expression(ExpressionStatement { expression, span: input.span }),
|
||||
_ => Statement::Expression(ExpressionStatement { expression, span: input.span, id: NodeID::default() }),
|
||||
};
|
||||
|
||||
(statement, additional_statements)
|
||||
|
@ -47,6 +47,7 @@ impl ProgramReconstructor for Unroller<'_> {
|
||||
output_type: finalize.output_type,
|
||||
block,
|
||||
span: finalize.span,
|
||||
id: NodeID::default(),
|
||||
}
|
||||
});
|
||||
|
||||
@ -61,6 +62,7 @@ impl ProgramReconstructor for Unroller<'_> {
|
||||
block,
|
||||
finalize,
|
||||
span: function.span,
|
||||
id: NodeID::default(),
|
||||
};
|
||||
|
||||
// Exit the function's scope.
|
||||
|
@ -30,6 +30,7 @@ impl StatementReconstructor for Unroller<'_> {
|
||||
let block = Block {
|
||||
statements: input.statements.into_iter().map(|s| self.reconstruct_statement(s).0).collect(),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
};
|
||||
|
||||
// Exit the block scope.
|
||||
|
@ -22,6 +22,7 @@ use leo_ast::{
|
||||
IntegerType,
|
||||
IterationStatement,
|
||||
Literal,
|
||||
NodeID,
|
||||
Statement,
|
||||
StatementReconstructor,
|
||||
Type,
|
||||
@ -127,6 +128,7 @@ impl<'a> Unroller<'a> {
|
||||
iter.map(|iteration_count| self.unroll_single_iteration(&input, iteration_count)).collect()
|
||||
}
|
||||
},
|
||||
id: NodeID::default(),
|
||||
});
|
||||
|
||||
// Exit the scope of the loop body.
|
||||
@ -147,34 +149,34 @@ impl<'a> Unroller<'a> {
|
||||
// Reconstruct `iteration_count` as a `Literal`.
|
||||
let value = match input.type_ {
|
||||
Type::Integer(IntegerType::I8) => {
|
||||
Literal::Integer(IntegerType::I8, iteration_count.to_string(), Default::default())
|
||||
Literal::Integer(IntegerType::I8, iteration_count.to_string(), Default::default(), NodeID::default())
|
||||
}
|
||||
Type::Integer(IntegerType::I16) => {
|
||||
Literal::Integer(IntegerType::I16, iteration_count.to_string(), Default::default())
|
||||
Literal::Integer(IntegerType::I16, iteration_count.to_string(), Default::default(), NodeID::default())
|
||||
}
|
||||
Type::Integer(IntegerType::I32) => {
|
||||
Literal::Integer(IntegerType::I32, iteration_count.to_string(), Default::default())
|
||||
Literal::Integer(IntegerType::I32, iteration_count.to_string(), Default::default(), NodeID::default())
|
||||
}
|
||||
Type::Integer(IntegerType::I64) => {
|
||||
Literal::Integer(IntegerType::I64, iteration_count.to_string(), Default::default())
|
||||
Literal::Integer(IntegerType::I64, iteration_count.to_string(), Default::default(), NodeID::default())
|
||||
}
|
||||
Type::Integer(IntegerType::I128) => {
|
||||
Literal::Integer(IntegerType::I128, iteration_count.to_string(), Default::default())
|
||||
Literal::Integer(IntegerType::I128, iteration_count.to_string(), Default::default(), NodeID::default())
|
||||
}
|
||||
Type::Integer(IntegerType::U8) => {
|
||||
Literal::Integer(IntegerType::U8, iteration_count.to_string(), Default::default())
|
||||
Literal::Integer(IntegerType::U8, iteration_count.to_string(), Default::default(), NodeID::default())
|
||||
}
|
||||
Type::Integer(IntegerType::U16) => {
|
||||
Literal::Integer(IntegerType::U16, iteration_count.to_string(), Default::default())
|
||||
Literal::Integer(IntegerType::U16, iteration_count.to_string(), Default::default(), NodeID::default())
|
||||
}
|
||||
Type::Integer(IntegerType::U32) => {
|
||||
Literal::Integer(IntegerType::U32, iteration_count.to_string(), Default::default())
|
||||
Literal::Integer(IntegerType::U32, iteration_count.to_string(), Default::default(), NodeID::default())
|
||||
}
|
||||
Type::Integer(IntegerType::U64) => {
|
||||
Literal::Integer(IntegerType::U64, iteration_count.to_string(), Default::default())
|
||||
Literal::Integer(IntegerType::U64, iteration_count.to_string(), Default::default(), NodeID::default())
|
||||
}
|
||||
Type::Integer(IntegerType::U128) => {
|
||||
Literal::Integer(IntegerType::U128, iteration_count.to_string(), Default::default())
|
||||
Literal::Integer(IntegerType::U128, iteration_count.to_string(), Default::default(), NodeID::default())
|
||||
}
|
||||
_ => unreachable!(
|
||||
"The iteration variable must be an integer type. This should be enforced by type checking."
|
||||
@ -189,6 +191,7 @@ impl<'a> Unroller<'a> {
|
||||
value: Expression::Literal(value),
|
||||
span: Default::default(),
|
||||
place: Expression::Identifier(input.variable),
|
||||
id: NodeID::default(),
|
||||
})
|
||||
.0,
|
||||
];
|
||||
@ -198,7 +201,7 @@ impl<'a> Unroller<'a> {
|
||||
statements.push(self.reconstruct_statement(s).0);
|
||||
});
|
||||
|
||||
let block = Statement::Block(Block { statements, span: input.block.span });
|
||||
let block = Statement::Block(Block { statements, span: input.block.span, id: NodeID::default() });
|
||||
|
||||
self.is_unrolling = prior_is_unrolling;
|
||||
|
||||
|
@ -27,6 +27,7 @@ use leo_ast::{
|
||||
Identifier,
|
||||
Literal,
|
||||
MemberAccess,
|
||||
NodeID,
|
||||
Statement,
|
||||
Struct,
|
||||
StructExpression,
|
||||
@ -64,6 +65,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
})
|
||||
.collect(),
|
||||
span: function.span,
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
statements,
|
||||
)
|
||||
@ -83,6 +85,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
inner: Box::new(expr),
|
||||
name: member.name,
|
||||
span: member.span,
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
statements,
|
||||
)
|
||||
@ -94,6 +97,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
tuple: Box::new(expr),
|
||||
index: tuple.index,
|
||||
span: tuple.span,
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
statements,
|
||||
)
|
||||
@ -121,6 +125,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
right: Box::new(right_expression),
|
||||
op: input.op,
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
statements.push(statement);
|
||||
|
||||
@ -150,6 +155,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
arguments,
|
||||
external: input.external,
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
statements.push(statement);
|
||||
|
||||
@ -166,6 +172,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
expression: Box::new(expression),
|
||||
type_: input.type_,
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
statements.push(statement);
|
||||
|
||||
@ -193,7 +200,12 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
statements.append(&mut stmts);
|
||||
|
||||
// Return the new member.
|
||||
StructVariableInitializer { identifier: arg.identifier, expression: Some(expression) }
|
||||
StructVariableInitializer {
|
||||
identifier: arg.identifier,
|
||||
expression: Some(expression),
|
||||
span: arg.span,
|
||||
id: NodeID::default(),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
@ -233,6 +245,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
name: input.name,
|
||||
span: input.span,
|
||||
members: reordered_members,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
statements.push(statement);
|
||||
|
||||
@ -255,7 +268,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
false => *self.rename_table.lookup(identifier.name).unwrap_or(&identifier.name),
|
||||
};
|
||||
|
||||
(Expression::Identifier(Identifier { name, span: identifier.span }), Default::default())
|
||||
(Expression::Identifier(Identifier { name, span: identifier.span, id: NodeID::default() }), Default::default())
|
||||
}
|
||||
|
||||
/// Consumes and returns the literal without making any modifications.
|
||||
@ -282,6 +295,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
if_true: Box::new(if_true_expr),
|
||||
if_false: Box::new(if_false_expr),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
statements.push(statement);
|
||||
|
||||
@ -304,9 +318,11 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
.collect();
|
||||
|
||||
// Construct and accumulate a new assignment statement for the tuple expression.
|
||||
let (place, statement) = self
|
||||
.assigner
|
||||
.unique_simple_assign_statement(Expression::Tuple(TupleExpression { elements, span: input.span }));
|
||||
let (place, statement) = self.assigner.unique_simple_assign_statement(Expression::Tuple(TupleExpression {
|
||||
elements,
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
statements.push(statement);
|
||||
|
||||
(Expression::Identifier(place), statements)
|
||||
@ -322,6 +338,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
||||
op: input.op,
|
||||
receiver: Box::new(receiver),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
statements.push(statement);
|
||||
|
||||
|
@ -22,6 +22,7 @@ use leo_ast::{
|
||||
Function,
|
||||
FunctionConsumer,
|
||||
Member,
|
||||
NodeID,
|
||||
Program,
|
||||
ProgramConsumer,
|
||||
ProgramScope,
|
||||
@ -73,7 +74,8 @@ impl FunctionConsumer for StaticSingleAssigner<'_> {
|
||||
self.rename_table.update(input_variable.identifier().name, input_variable.identifier().name);
|
||||
}
|
||||
|
||||
let block = Block { span: function.block.span, statements: self.consume_block(function.block) };
|
||||
let block =
|
||||
Block { span: function.block.span, statements: self.consume_block(function.block), id: NodeID::default() };
|
||||
|
||||
// Remove the `RenameTable` for the function.
|
||||
self.pop();
|
||||
@ -88,7 +90,11 @@ impl FunctionConsumer for StaticSingleAssigner<'_> {
|
||||
self.rename_table.update(input_variable.identifier().name, input_variable.identifier().name);
|
||||
}
|
||||
|
||||
let block = Block { span: finalize.block.span, statements: self.consume_block(finalize.block) };
|
||||
let block = Block {
|
||||
span: finalize.block.span,
|
||||
statements: self.consume_block(finalize.block),
|
||||
id: NodeID::default(),
|
||||
};
|
||||
|
||||
// Remove the `RenameTable` for the finalize block.
|
||||
self.pop();
|
||||
@ -100,6 +106,7 @@ impl FunctionConsumer for StaticSingleAssigner<'_> {
|
||||
output_type: finalize.output_type,
|
||||
block,
|
||||
span: finalize.span,
|
||||
id: NodeID::default(),
|
||||
}
|
||||
});
|
||||
|
||||
@ -113,6 +120,7 @@ impl FunctionConsumer for StaticSingleAssigner<'_> {
|
||||
block,
|
||||
finalize,
|
||||
span: function.span,
|
||||
id: NodeID::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ use leo_ast::{
|
||||
ExpressionStatement,
|
||||
Identifier,
|
||||
IterationStatement,
|
||||
NodeID,
|
||||
ReturnStatement,
|
||||
Statement,
|
||||
StatementConsumer,
|
||||
@ -75,7 +76,7 @@ impl StatementConsumer for StaticSingleAssigner<'_> {
|
||||
};
|
||||
|
||||
// Add the assert statement to the list of produced statements.
|
||||
statements.push(Statement::Assert(AssertStatement { variant, span: input.span }));
|
||||
statements.push(Statement::Assert(AssertStatement { variant, span: input.span, id: NodeID::default() }));
|
||||
|
||||
statements
|
||||
}
|
||||
@ -119,7 +120,11 @@ impl StatementConsumer for StaticSingleAssigner<'_> {
|
||||
self.push();
|
||||
|
||||
// Consume the then-block.
|
||||
let then = Block { span: conditional.then.span, statements: self.consume_block(conditional.then) };
|
||||
let then = Block {
|
||||
span: conditional.then.span,
|
||||
statements: self.consume_block(conditional.then),
|
||||
id: NodeID::default(),
|
||||
};
|
||||
|
||||
// Remove the `RenameTable` for the then-block.
|
||||
let if_table = self.pop();
|
||||
@ -132,10 +137,12 @@ impl StatementConsumer for StaticSingleAssigner<'_> {
|
||||
Statement::Block(block) => Block {
|
||||
span: block.span,
|
||||
statements: self.consume_block(block),
|
||||
id: NodeID::default(),
|
||||
},
|
||||
Statement::Conditional(conditional) => Block {
|
||||
span: conditional.span,
|
||||
statements: self.consume_conditional(conditional),
|
||||
id: NodeID::default()
|
||||
},
|
||||
_ => unreachable!("Type checking guarantees that the otherwise-block of a conditional statement is a block or another conditional statement."),
|
||||
})));
|
||||
@ -149,6 +156,7 @@ impl StatementConsumer for StaticSingleAssigner<'_> {
|
||||
condition: condition.clone(),
|
||||
then,
|
||||
otherwise,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
|
||||
// Compute the write set for the variables written in the then-block or otherwise-block.
|
||||
@ -164,7 +172,11 @@ impl StatementConsumer for StaticSingleAssigner<'_> {
|
||||
let create_phi_argument = |table: &RenameTable, symbol: Symbol| {
|
||||
let name =
|
||||
*table.lookup(symbol).unwrap_or_else(|| panic!("Symbol {symbol} should exist in the program."));
|
||||
Box::new(Expression::Identifier(Identifier { name, span: Default::default() }))
|
||||
Box::new(Expression::Identifier(Identifier {
|
||||
name,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
};
|
||||
|
||||
// Create a new name for the variable written to in the `ConditionalStatement`.
|
||||
@ -175,14 +187,16 @@ impl StatementConsumer for StaticSingleAssigner<'_> {
|
||||
if_true: create_phi_argument(&if_table, **symbol),
|
||||
if_false: create_phi_argument(&else_table, **symbol),
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
});
|
||||
|
||||
statements.extend(stmts);
|
||||
|
||||
// Create a new `AssignStatement` for the phi function.
|
||||
let assignment = self
|
||||
.assigner
|
||||
.simple_assign_statement(Identifier { name: new_name, span: Default::default() }, value);
|
||||
let assignment = self.assigner.simple_assign_statement(
|
||||
Identifier { name: new_name, span: Default::default(), id: NodeID::default() },
|
||||
value,
|
||||
);
|
||||
|
||||
// Update the `RenameTable` with the new name of the variable.
|
||||
self.rename_table.update(*(*symbol), new_name);
|
||||
@ -230,9 +244,14 @@ impl StatementConsumer for StaticSingleAssigner<'_> {
|
||||
}
|
||||
}).collect();
|
||||
statements.push(Statement::Assign(Box::new(AssignStatement {
|
||||
place: Expression::Tuple(TupleExpression { elements, span: Default::default() }),
|
||||
place: Expression::Tuple(TupleExpression {
|
||||
elements,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
value,
|
||||
span: Default::default(),
|
||||
id: NodeID::default(),
|
||||
})));
|
||||
}
|
||||
_ => unreachable!(
|
||||
@ -272,8 +291,10 @@ impl StatementConsumer for StaticSingleAssigner<'_> {
|
||||
arguments,
|
||||
external: call.external,
|
||||
span: call.span,
|
||||
id: NodeID::default(),
|
||||
}),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
}
|
||||
Expression::Access(AccessExpression::AssociatedFunction(associated_function)) => {
|
||||
@ -287,8 +308,10 @@ impl StatementConsumer for StaticSingleAssigner<'_> {
|
||||
name: associated_function.name,
|
||||
arguments,
|
||||
span: associated_function.span,
|
||||
id: NodeID::default(),
|
||||
})),
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}))
|
||||
}
|
||||
|
||||
@ -327,6 +350,7 @@ impl StatementConsumer for StaticSingleAssigner<'_> {
|
||||
expression,
|
||||
finalize_arguments: finalize_args,
|
||||
span: input.span,
|
||||
id: NodeID::default(),
|
||||
}));
|
||||
|
||||
statements
|
||||
|
@ -595,10 +595,10 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
||||
}
|
||||
|
||||
Some(match input {
|
||||
Literal::Address(_, _) => self.assert_and_return_type(Type::Address, expected, input.span()),
|
||||
Literal::Boolean(_, _) => self.assert_and_return_type(Type::Boolean, expected, input.span()),
|
||||
Literal::Field(_, _) => self.assert_and_return_type(Type::Field, expected, input.span()),
|
||||
Literal::Integer(integer_type, string, _) => match integer_type {
|
||||
Literal::Address(_, _, _) => self.assert_and_return_type(Type::Address, expected, input.span()),
|
||||
Literal::Boolean(_, _, _) => self.assert_and_return_type(Type::Boolean, expected, input.span()),
|
||||
Literal::Field(_, _, _) => self.assert_and_return_type(Type::Field, expected, input.span()),
|
||||
Literal::Integer(integer_type, string, _, _) => match integer_type {
|
||||
IntegerType::U8 => {
|
||||
parse_integer_literal::<u8>(self.handler, string, input.span(), "u8");
|
||||
self.assert_and_return_type(Type::Integer(IntegerType::U8), expected, input.span())
|
||||
@ -641,8 +641,8 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
||||
}
|
||||
},
|
||||
Literal::Group(_) => self.assert_and_return_type(Type::Group, expected, input.span()),
|
||||
Literal::Scalar(_, _) => self.assert_and_return_type(Type::Scalar, expected, input.span()),
|
||||
Literal::String(_, _) => {
|
||||
Literal::Scalar(_, _, _) => self.assert_and_return_type(Type::Scalar, expected, input.span()),
|
||||
Literal::String(_, _, _) => {
|
||||
self.emit_err(TypeCheckerError::strings_are_not_supported(input.span()));
|
||||
self.assert_and_return_type(Type::String, expected, input.span())
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
|
||||
check_has_field(sym::owner, Type::Address);
|
||||
}
|
||||
|
||||
for Member { mode, identifier, type_, span } in input.members.iter() {
|
||||
for Member { mode, identifier, type_, span, .. } in input.members.iter() {
|
||||
// Check that the member type is not a tuple.
|
||||
if matches!(type_, Type::Tuple(_)) {
|
||||
self.emit_err(TypeCheckerError::composite_data_type_cannot_contain_tuple(
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: af4bf950a53dee2547324d1d139661bc2f881f1a7e9941fe34a85b3745c6958d
|
||||
unrolled_ast: af4bf950a53dee2547324d1d139661bc2f881f1a7e9941fe34a85b3745c6958d
|
||||
ssa_ast: 71af510447b440ecf9517b244604dead0fb36905201d7205e1da396acd0de0fe
|
||||
flattened_ast: 5b0842e447b4e1f92f4bcd22824ed5e12c51c8db145d1541763d10ad3dc1f37a
|
||||
inlined_ast: 5b0842e447b4e1f92f4bcd22824ed5e12c51c8db145d1541763d10ad3dc1f37a
|
||||
dce_ast: 946b0fe81e942060d870c228afb1a31c42501fb8f9c481d35d7908b226af5cbe
|
||||
- - initial_ast: aedbecdddf47324809cfe36a7329e30e0b02cb1a8e079ea3c6a1fed485eb6a23
|
||||
unrolled_ast: aedbecdddf47324809cfe36a7329e30e0b02cb1a8e079ea3c6a1fed485eb6a23
|
||||
ssa_ast: 6495fd7481d1b9490b37eb367af3f47f367d5571bed98476ba465441ffb6af52
|
||||
flattened_ast: d768a50e70e99bbbebbf391db1363d50ea42a2a64997319fe442c862eb477a12
|
||||
inlined_ast: d768a50e70e99bbbebbf391db1363d50ea42a2a64997319fe442c862eb477a12
|
||||
dce_ast: 195cdd11eab6742a8726b398d7fe1ad5b2ed170a9ef63b8da24e5c9bfed7e066
|
||||
bytecode: e434c09cee27a5dfb5a4e9e9fd26aa2ba6e7f0653fad3a4f2a7d85983ba559c9
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: b45e54f18036a13051f622f2d8230240aaee77231e39a1b7cdb196615fb4829e
|
||||
unrolled_ast: b45e54f18036a13051f622f2d8230240aaee77231e39a1b7cdb196615fb4829e
|
||||
ssa_ast: 0d44a08f0cace01d86fec36ea409e6424ff21f9ee8834f53062569af8c35579e
|
||||
flattened_ast: c1b6954bff1ce18c0bb3be1cd6392a554a15989c90939c99e375221b1003e3b7
|
||||
inlined_ast: c1b6954bff1ce18c0bb3be1cd6392a554a15989c90939c99e375221b1003e3b7
|
||||
dce_ast: c1b6954bff1ce18c0bb3be1cd6392a554a15989c90939c99e375221b1003e3b7
|
||||
- - initial_ast: e64985069c66d2678488b57ceab0026149c4ebaf1fc42ac15798fdc306f74d20
|
||||
unrolled_ast: e64985069c66d2678488b57ceab0026149c4ebaf1fc42ac15798fdc306f74d20
|
||||
ssa_ast: 073128b766cc8ea00519d7cdee4714796e631f2847db5f55b75d829101bd9552
|
||||
flattened_ast: 9b5233811932dc7004d77590063c9b7d2ff00be8bd7c7c8c81192ce5df740175
|
||||
inlined_ast: 9b5233811932dc7004d77590063c9b7d2ff00be8bd7c7c8c81192ce5df740175
|
||||
dce_ast: 9b5233811932dc7004d77590063c9b7d2ff00be8bd7c7c8c81192ce5df740175
|
||||
bytecode: da1b0a83a17b801368b0a583b158d88d9d807a33000c8e89e82da123c8041aea
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 439fd89a480274e3cf43dbc8e9ebc50188b2dc6288fa2ce7da9d8c0211fae8ec
|
||||
unrolled_ast: 439fd89a480274e3cf43dbc8e9ebc50188b2dc6288fa2ce7da9d8c0211fae8ec
|
||||
ssa_ast: 96122b72b05f839341f0f808bf47523fc976c219e1284c2fad253ebc159d84ff
|
||||
flattened_ast: f9458e7824444415aa9f3feec4924461f49dee915429e63dec244806d3812722
|
||||
inlined_ast: f9458e7824444415aa9f3feec4924461f49dee915429e63dec244806d3812722
|
||||
dce_ast: f9458e7824444415aa9f3feec4924461f49dee915429e63dec244806d3812722
|
||||
- - initial_ast: 7a1afdab98a730090c3370305d8fa23a7a69f779b492288ab8bae2169b880118
|
||||
unrolled_ast: 7a1afdab98a730090c3370305d8fa23a7a69f779b492288ab8bae2169b880118
|
||||
ssa_ast: faaa8bd1f0f1f9d0c2d20cf6e8265e8db0593930bf38451509a218fdca25905a
|
||||
flattened_ast: 94377cdcfd12afd021b97302dc880bca782aeb9ea8b908dd3f8ef19e4d231e69
|
||||
inlined_ast: 94377cdcfd12afd021b97302dc880bca782aeb9ea8b908dd3f8ef19e4d231e69
|
||||
dce_ast: 94377cdcfd12afd021b97302dc880bca782aeb9ea8b908dd3f8ef19e4d231e69
|
||||
bytecode: bde2653fac0393940c5400272e53492228206e50abb36ce080b95043003ee976
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 08283a817bc0589f8382ac381dea3345b55a4a04c87b1ad743e4ce05d2439ac4
|
||||
unrolled_ast: 08283a817bc0589f8382ac381dea3345b55a4a04c87b1ad743e4ce05d2439ac4
|
||||
ssa_ast: 6b09114518e99d698d0709d7b78fb8fa521e87cc98eb32af8898b344cd611b6d
|
||||
flattened_ast: 1041763865cf86407bf30dae2b003ec9094e91e79c3e5b493b54fbd67cdd8f24
|
||||
inlined_ast: 1041763865cf86407bf30dae2b003ec9094e91e79c3e5b493b54fbd67cdd8f24
|
||||
dce_ast: 1041763865cf86407bf30dae2b003ec9094e91e79c3e5b493b54fbd67cdd8f24
|
||||
- - initial_ast: 3e3635b9f0e8098731455f2d2b49026c90cea00d07461e7cbcaa5759bf823be4
|
||||
unrolled_ast: 3e3635b9f0e8098731455f2d2b49026c90cea00d07461e7cbcaa5759bf823be4
|
||||
ssa_ast: 21ca11c494c4f9c4e204f368e967727bda93ce65962c86935ce2fe6895197ebb
|
||||
flattened_ast: c5ebee78d83725ede5e4dce6ca0f77339b3d5dd0eb727fbf32bd6c476f569173
|
||||
inlined_ast: c5ebee78d83725ede5e4dce6ca0f77339b3d5dd0eb727fbf32bd6c476f569173
|
||||
dce_ast: c5ebee78d83725ede5e4dce6ca0f77339b3d5dd0eb727fbf32bd6c476f569173
|
||||
bytecode: c0b90b7f7e80041dc1a314c1a87290534936018fb001c6e1291266a02393c6f2
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 800f83913bb57aac57e0574c67deda923814503eaa812fb82280a7ffd64f038f
|
||||
unrolled_ast: 800f83913bb57aac57e0574c67deda923814503eaa812fb82280a7ffd64f038f
|
||||
ssa_ast: e0015762d1fb228999fd2ef236fae8fcf8bd6e6bbd0ce37fad230a708ca063d2
|
||||
flattened_ast: 4e7759584ade51a19ff90284e5ee1ac91af6dad5cd966568b708ead553a8a4bd
|
||||
inlined_ast: 4e7759584ade51a19ff90284e5ee1ac91af6dad5cd966568b708ead553a8a4bd
|
||||
dce_ast: 4e7759584ade51a19ff90284e5ee1ac91af6dad5cd966568b708ead553a8a4bd
|
||||
- - initial_ast: 83a584fa8274354e7caf1b9f530ee91008fb867a341045e84f1849cd8dc88e88
|
||||
unrolled_ast: 83a584fa8274354e7caf1b9f530ee91008fb867a341045e84f1849cd8dc88e88
|
||||
ssa_ast: 999147035ff811021e9a050ec2fabecb6ff70eacbac0ca4b6c143b9105dfd28e
|
||||
flattened_ast: 0839b38833dc1b6dfcf512a031d4c6fa17de417ee965fd33963c9ed5eb0b7b01
|
||||
inlined_ast: 0839b38833dc1b6dfcf512a031d4c6fa17de417ee965fd33963c9ed5eb0b7b01
|
||||
dce_ast: 0839b38833dc1b6dfcf512a031d4c6fa17de417ee965fd33963c9ed5eb0b7b01
|
||||
bytecode: 134904b86b96581876c2ca0c6ead651dda0dc9f2fb6dc583400133410b7deede
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 080edd413ce668be563c96e2625ba86d935b529a25ff2d009a41c36d63e90867
|
||||
unrolled_ast: 080edd413ce668be563c96e2625ba86d935b529a25ff2d009a41c36d63e90867
|
||||
ssa_ast: 42925975f1f91dc72941e3c018d6c0595824086f50fa5e6398f21649a57c6661
|
||||
flattened_ast: de891bab08a157399fdceeeccc7c3d4fd70cc3f75d1ca694a4fcd0344fdaac20
|
||||
inlined_ast: de891bab08a157399fdceeeccc7c3d4fd70cc3f75d1ca694a4fcd0344fdaac20
|
||||
dce_ast: de891bab08a157399fdceeeccc7c3d4fd70cc3f75d1ca694a4fcd0344fdaac20
|
||||
- - initial_ast: 28c909dfc3df83359c4f2f4b989329201c16e944b5c1206c0b770753cf07b60a
|
||||
unrolled_ast: 28c909dfc3df83359c4f2f4b989329201c16e944b5c1206c0b770753cf07b60a
|
||||
ssa_ast: 9a9c933d5a770b15fda13380e32bdcb72353582dc4e60db47c46ed5a95bead6f
|
||||
flattened_ast: f7a6fe164fe7eea96468302395fa5f7a78ebed2b7bab56bbee925f773c5d290d
|
||||
inlined_ast: f7a6fe164fe7eea96468302395fa5f7a78ebed2b7bab56bbee925f773c5d290d
|
||||
dce_ast: f7a6fe164fe7eea96468302395fa5f7a78ebed2b7bab56bbee925f773c5d290d
|
||||
bytecode: 56a9fa48a00d1b38b6f60a93ef2168b2c0ce9c23ba3cb7bffa40debfc1b16180
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: ad12566d0b8f3bef282b67823b427a74e56acbcc34acaa4f939097fb451ea7d9
|
||||
unrolled_ast: ad12566d0b8f3bef282b67823b427a74e56acbcc34acaa4f939097fb451ea7d9
|
||||
ssa_ast: 453e77387be9254ded9019b6c362721f766ebf5a5b2d3604e51ae81452fac4e8
|
||||
flattened_ast: b39344c70e1a23869b236146ace198addf0801b348deedfb3e4ff1e3c4ace904
|
||||
inlined_ast: b39344c70e1a23869b236146ace198addf0801b348deedfb3e4ff1e3c4ace904
|
||||
dce_ast: b39344c70e1a23869b236146ace198addf0801b348deedfb3e4ff1e3c4ace904
|
||||
- - initial_ast: c78718de7e86670216551ca3e1a7ff79eac984bbd7d3916efc0471fc47dac07e
|
||||
unrolled_ast: c78718de7e86670216551ca3e1a7ff79eac984bbd7d3916efc0471fc47dac07e
|
||||
ssa_ast: e5a52db1daeec16966a78bb2f7ef2449af7a7e1ff6eab67a63f24030b0d8077b
|
||||
flattened_ast: f7632dc71f1fcdb0c810dc41804d7a774f6470d667667ea4ebafaef764c37c62
|
||||
inlined_ast: f7632dc71f1fcdb0c810dc41804d7a774f6470d667667ea4ebafaef764c37c62
|
||||
dce_ast: f7632dc71f1fcdb0c810dc41804d7a774f6470d667667ea4ebafaef764c37c62
|
||||
bytecode: 2332d5b7ed9910dc65c885e1aeedbbde00e02d95a55caa300a9cb72456707034
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 5c885cc9e6d5df3602e09f7b53cb49ee4bca3a57d647044d4d321de32c4cdd90
|
||||
unrolled_ast: 5c885cc9e6d5df3602e09f7b53cb49ee4bca3a57d647044d4d321de32c4cdd90
|
||||
ssa_ast: 211f4122a90e6a117dc4fe2e7ca3c3e21bdc09a4c7992b212b6c34c283e896f6
|
||||
flattened_ast: 84fd34b95b75f6d72b28164a9cb2ac80fa4149564c8c187b0ead1e14d2299a63
|
||||
inlined_ast: 84fd34b95b75f6d72b28164a9cb2ac80fa4149564c8c187b0ead1e14d2299a63
|
||||
dce_ast: 84fd34b95b75f6d72b28164a9cb2ac80fa4149564c8c187b0ead1e14d2299a63
|
||||
- - initial_ast: 9e871518f362d925d3a49dc805f25270f20d8b471e75dca55bd08ddd95dba0a7
|
||||
unrolled_ast: 9e871518f362d925d3a49dc805f25270f20d8b471e75dca55bd08ddd95dba0a7
|
||||
ssa_ast: 4df5ebccb2b9337d9570b8b674bf110b21f03e19eed2bd62720503675dd0ed76
|
||||
flattened_ast: 1d523dd55672a7be0a853091da70a15e24c028f0585808b60bb4d435d2e28866
|
||||
inlined_ast: 1d523dd55672a7be0a853091da70a15e24c028f0585808b60bb4d435d2e28866
|
||||
dce_ast: 1d523dd55672a7be0a853091da70a15e24c028f0585808b60bb4d435d2e28866
|
||||
bytecode: 990eee0b87d70df046bad969201ad8afabff10162eb70c00f837fde81fed4104
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 3fda93baba12b9f280ffad75a662dfd16def0a7a1414de4cd29aa0e5afff85cc
|
||||
unrolled_ast: 3fda93baba12b9f280ffad75a662dfd16def0a7a1414de4cd29aa0e5afff85cc
|
||||
ssa_ast: 0ae9482705f95c26507f0040b972c76267a30eaa265f95764c758613d841932b
|
||||
flattened_ast: 1e61c9d9ccdae7fb4aed4d7332538438839bef08a322f52fabcf46eac7bfc9c8
|
||||
inlined_ast: 1e61c9d9ccdae7fb4aed4d7332538438839bef08a322f52fabcf46eac7bfc9c8
|
||||
dce_ast: ab80f3a28ba9de58b165074c3ffae7e5be48e721bf17219252cecc0a6fb8b6e4
|
||||
- - initial_ast: 51323fd6e2305e68d3a49b1e3beff44a25962a9d2f981952270725a10fb907eb
|
||||
unrolled_ast: 51323fd6e2305e68d3a49b1e3beff44a25962a9d2f981952270725a10fb907eb
|
||||
ssa_ast: 7480cf469ca3ed640d36d8c171a975885590bbc3cfaec0805d9d8aef6cd19518
|
||||
flattened_ast: 2610072b45f28619332adf130aa46d92bb6d3e008c88e0d59c35407d7fe84a09
|
||||
inlined_ast: 2610072b45f28619332adf130aa46d92bb6d3e008c88e0d59c35407d7fe84a09
|
||||
dce_ast: a5cc2bdb045e2f9e981c12c2411f397b4af69a2aa6cb3a83b14403ce3155e8d6
|
||||
bytecode: bb260232bbd0ccede368961a31abeef5edc7e00cab3348b4b8518d4e5798a6b5
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 3281347d18634932dba7502590f4ed0a45e15205fecdfb11846a1ac9de0a7c10
|
||||
unrolled_ast: 3281347d18634932dba7502590f4ed0a45e15205fecdfb11846a1ac9de0a7c10
|
||||
ssa_ast: f1ecffe7065e9782af5bf452b6ea547bfb5026a4c56e0c3105077c85ce196216
|
||||
flattened_ast: cf5034c292702654bd282c10c8d1abafed8ed328f8e6cd0a01b286438809afd5
|
||||
inlined_ast: cf5034c292702654bd282c10c8d1abafed8ed328f8e6cd0a01b286438809afd5
|
||||
dce_ast: cf5034c292702654bd282c10c8d1abafed8ed328f8e6cd0a01b286438809afd5
|
||||
- - initial_ast: 7cce4e768432d303e86d5d8f38ca10df9fcb641ab1bd791cfed3180594f6cea7
|
||||
unrolled_ast: 7cce4e768432d303e86d5d8f38ca10df9fcb641ab1bd791cfed3180594f6cea7
|
||||
ssa_ast: a8dcccc18c4984c95a15bc850343a4c0a6bd4de3745cee2d9dc5f204bf8d5290
|
||||
flattened_ast: dac527fa65b44faef014c5046d668bf8f4fb6731beedf04369367b546521d54f
|
||||
inlined_ast: dac527fa65b44faef014c5046d668bf8f4fb6731beedf04369367b546521d54f
|
||||
dce_ast: dac527fa65b44faef014c5046d668bf8f4fb6731beedf04369367b546521d54f
|
||||
bytecode: c3a0c03f4324a6dd6baea42e664ffad91868714739e03525dcbc968582007ceb
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 2fcf759a6b067a1ab144a067c2a4ea41c49499febb7e6a5056dc25db633dd37c
|
||||
unrolled_ast: 2fcf759a6b067a1ab144a067c2a4ea41c49499febb7e6a5056dc25db633dd37c
|
||||
ssa_ast: a55cc6f9a1abaaa66e51ee6e9e946f6fbab282cc2e0ea1a48d6f1aa7da88dda1
|
||||
flattened_ast: fbb82b282d5fb0864a21f3a0f0271fdefa2b58fe80a3aba5c7307d5a9c5bfa68
|
||||
inlined_ast: fbb82b282d5fb0864a21f3a0f0271fdefa2b58fe80a3aba5c7307d5a9c5bfa68
|
||||
dce_ast: fbb82b282d5fb0864a21f3a0f0271fdefa2b58fe80a3aba5c7307d5a9c5bfa68
|
||||
- - initial_ast: c45d509ec04f7f518387ad6a3e24a97631a50ab4d0cf122af78e03df5cb41328
|
||||
unrolled_ast: c45d509ec04f7f518387ad6a3e24a97631a50ab4d0cf122af78e03df5cb41328
|
||||
ssa_ast: 6aa7493d54a6eb2a5136980f379966cb25198c905c358b807c10bdb4e163de5d
|
||||
flattened_ast: 047a89ee6cdf364b877eca15cdc92954c7ba669fddd3c99fece729abcfd211e3
|
||||
inlined_ast: 047a89ee6cdf364b877eca15cdc92954c7ba669fddd3c99fece729abcfd211e3
|
||||
dce_ast: 047a89ee6cdf364b877eca15cdc92954c7ba669fddd3c99fece729abcfd211e3
|
||||
bytecode: 3c391009be59588562aa4a34d1b00508cd253c94d35a66741962352c76a92633
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: c97efd0956a3c8d6a511b38d61f3f3bdd34d95ad2f78242d2816c723d1676997
|
||||
unrolled_ast: c97efd0956a3c8d6a511b38d61f3f3bdd34d95ad2f78242d2816c723d1676997
|
||||
ssa_ast: 0a690ca166cfd10c1b57d3df756032f10b003cc0d006bf27f41901b6af2ce95e
|
||||
flattened_ast: 083a9af2e592de0c827b15230cd2307daae4b90e324e35714f474d50cbb59162
|
||||
inlined_ast: 083a9af2e592de0c827b15230cd2307daae4b90e324e35714f474d50cbb59162
|
||||
dce_ast: 083a9af2e592de0c827b15230cd2307daae4b90e324e35714f474d50cbb59162
|
||||
- - initial_ast: d208faafad448ad0877c98ca0e950a6de31dd1ed12332c5475f670fda163280f
|
||||
unrolled_ast: d208faafad448ad0877c98ca0e950a6de31dd1ed12332c5475f670fda163280f
|
||||
ssa_ast: a69d601b77e30b0a5564c8c97308b6a4d377a8484dfcfc476f8ceeaa48334d98
|
||||
flattened_ast: dc6accfaa25f07245d9f7c6b281e9924fc02b3c2175eb8930f9a925e0372a694
|
||||
inlined_ast: dc6accfaa25f07245d9f7c6b281e9924fc02b3c2175eb8930f9a925e0372a694
|
||||
dce_ast: dc6accfaa25f07245d9f7c6b281e9924fc02b3c2175eb8930f9a925e0372a694
|
||||
bytecode: 3ff716b96c532801f4fa5310f4eedf8f96fe15bd7db3bf087e7b64a161153945
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 6417c752e4968610c42d36d9826dae8b4db63c6330213de3b502cefd4eb3398e
|
||||
unrolled_ast: 6417c752e4968610c42d36d9826dae8b4db63c6330213de3b502cefd4eb3398e
|
||||
ssa_ast: 3b8dfc337c376f4cd2481943117645906ea60c1d7c01b574facdfa7e9d45d40c
|
||||
flattened_ast: dd5cc399b597020a3560b66a49524d482c3a19f73fb6ce5db1c16956a75e6ceb
|
||||
inlined_ast: dd5cc399b597020a3560b66a49524d482c3a19f73fb6ce5db1c16956a75e6ceb
|
||||
dce_ast: 2632a68c7bcaf198306ebee254255fdd7bb9e414a18aff701b61c20970c83736
|
||||
- - initial_ast: 6fd597b235a9ab6fa532413d5656c125639ebe5036284da78f9e5b6c69007b7d
|
||||
unrolled_ast: 6fd597b235a9ab6fa532413d5656c125639ebe5036284da78f9e5b6c69007b7d
|
||||
ssa_ast: 08bffe308901f0274b378f5b9011df8c245fc51d69856317430b78b5916f3943
|
||||
flattened_ast: e77fd9b2be65e8a05590387d093a18607cdc7130fcb42c9f48820b28285219c4
|
||||
inlined_ast: e77fd9b2be65e8a05590387d093a18607cdc7130fcb42c9f48820b28285219c4
|
||||
dce_ast: 4cdfeac49296a80c83c11ed59e1eadf21051ef9d851f58a02d42d1b61b319ed1
|
||||
bytecode: 03845ec2f54d49f71640659603ead8f68ad067a15fda438e5e13524777d1559b
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 086f141b1c5abf33b33552e8f4afee66d1329feeef57ce75112998389d72a4c4
|
||||
unrolled_ast: 086f141b1c5abf33b33552e8f4afee66d1329feeef57ce75112998389d72a4c4
|
||||
ssa_ast: e41102928f21811470f44435b92472ed723d8ae2a585fc0fbcb1797e9346a638
|
||||
flattened_ast: ab5b47d4fab10de2cab10760eae24353f988b2fedd5f7fb9fe2886a87e0c3633
|
||||
inlined_ast: ab5b47d4fab10de2cab10760eae24353f988b2fedd5f7fb9fe2886a87e0c3633
|
||||
dce_ast: cb018621c3d6099c5f0e42185c9d83ac3fdf7b00381456aff4ccba2749af0e38
|
||||
- - initial_ast: bd3ad043ad61fc8636d1bd58ce0b7a47267a4984546b02a42a0fced89751be66
|
||||
unrolled_ast: bd3ad043ad61fc8636d1bd58ce0b7a47267a4984546b02a42a0fced89751be66
|
||||
ssa_ast: b64e7c6c0130cf4855985b81424843521d8694b6756c137d392e0d560045851e
|
||||
flattened_ast: ab295e2feb5d6e653270f88fe341d8a2aacd26e09a1949ae87c17440a2175b97
|
||||
inlined_ast: ab295e2feb5d6e653270f88fe341d8a2aacd26e09a1949ae87c17440a2175b97
|
||||
dce_ast: 91da30c194862277ddc99fef9ee7ec374649461eea7f89c29fcb48e7fa583c59
|
||||
bytecode: 680bee256d40c3ca4226844e73ae277e6db6af6398cab44674e421359f50cb83
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 30af76fe81f9f4708fd950b4e9969ccd98848fd19ed0186039595d1e5a27844d
|
||||
unrolled_ast: 30af76fe81f9f4708fd950b4e9969ccd98848fd19ed0186039595d1e5a27844d
|
||||
ssa_ast: 802c704ffee618f1ba6cc45b03dc38d8804d97291247332ce2b3d6fe3013db09
|
||||
flattened_ast: 73ca3b7c2d21074790829863c66cb65d61a558e7ce78a95825836fe97a6a82ad
|
||||
inlined_ast: 73ca3b7c2d21074790829863c66cb65d61a558e7ce78a95825836fe97a6a82ad
|
||||
dce_ast: e49f3a349238d24bf30e10bbe2b77cd0d55b1cd797076b3f14e2c80ba744e3f2
|
||||
- - initial_ast: c9b0ddeb037da9e40d05ede3b7a8fb64087f2ac47fb4c1f0c0523a2e3b50cb85
|
||||
unrolled_ast: c9b0ddeb037da9e40d05ede3b7a8fb64087f2ac47fb4c1f0c0523a2e3b50cb85
|
||||
ssa_ast: be3af5d7c55442200353dee77047d0a30d8873eb25d0b7da0786fb15b074fd1e
|
||||
flattened_ast: 5a90052cf2d88212d54c987ba60339d4b5d9579d2316965a799662ecba6b4b8c
|
||||
inlined_ast: 5a90052cf2d88212d54c987ba60339d4b5d9579d2316965a799662ecba6b4b8c
|
||||
dce_ast: d8ed4af576dfa745f37cd9ca9256ab9067bf9f6e56a0dbf76523ba7b859c7ff9
|
||||
bytecode: 83cd9a0a063adab9de89253b1a5be0b4bbdc04a2a73a62a03fc1dd1639a4fbbf
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 8fb7dc654017095718860202609b0ca646f3d877a692e53bf8933de7c8432edb
|
||||
unrolled_ast: 8fb7dc654017095718860202609b0ca646f3d877a692e53bf8933de7c8432edb
|
||||
ssa_ast: 82079d59219c8482e09d9f81b09916857317b9755575de86c64d0d1d719e5b01
|
||||
flattened_ast: 05559bf1900a3ac699da388ff7bb1ba8a4b715dcea4c6c5f1471d9538b944a32
|
||||
inlined_ast: 05559bf1900a3ac699da388ff7bb1ba8a4b715dcea4c6c5f1471d9538b944a32
|
||||
dce_ast: f03fb808180c842f2ce1ad49fb2c59b4aad76eb8d606ff1683d4b0042c75ece6
|
||||
- - initial_ast: 0abc353cf7d65b1c1b0272dea8760b66a479cd83656397498c6e804fcc57eca9
|
||||
unrolled_ast: 0abc353cf7d65b1c1b0272dea8760b66a479cd83656397498c6e804fcc57eca9
|
||||
ssa_ast: ce832fb383ceccaaa63b629cea7da2a3bb918e891499dd0027e9eeb86aeb9a8d
|
||||
flattened_ast: 1522af9dca9861839b442c6e5e8a935d60c4fde932fba9ae125eee7f917405ab
|
||||
inlined_ast: 1522af9dca9861839b442c6e5e8a935d60c4fde932fba9ae125eee7f917405ab
|
||||
dce_ast: a221711722c11cb03087868a6670573bf17f47cf1303c75515950c3e28e86626
|
||||
bytecode: 03845ec2f54d49f71640659603ead8f68ad067a15fda438e5e13524777d1559b
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 0579d18f1a8df1d3aaf97d5022d2b0cad4edd90b134440c37fdc1050b8ad2b93
|
||||
unrolled_ast: 0579d18f1a8df1d3aaf97d5022d2b0cad4edd90b134440c37fdc1050b8ad2b93
|
||||
ssa_ast: 2939f05bb3914ceca7cb9006092e88b18424bb76aa158a445f93553d3c3bec2a
|
||||
flattened_ast: 8aa371d2247fdbb90e449df1b5e8bc9abb37e0c9f95aae0c2a314bb96fd1094e
|
||||
inlined_ast: 8aa371d2247fdbb90e449df1b5e8bc9abb37e0c9f95aae0c2a314bb96fd1094e
|
||||
dce_ast: de6134fc83e79a1b4f9ce320735bdf15a33d0857fc118984cefe76ac754db1fb
|
||||
- - initial_ast: 8737bb14b9811f8393e7b1214f875f6298a4cced885ff1d0b103b87c4dae42e7
|
||||
unrolled_ast: 8737bb14b9811f8393e7b1214f875f6298a4cced885ff1d0b103b87c4dae42e7
|
||||
ssa_ast: ffdef22bb99c2f24950b74419fe2a51b15dfd3efb7f1faed43f8d452fb21ad33
|
||||
flattened_ast: 207311ab56f2ec438a841db6db558c009b5a74a21a335f83b957f6dd246ca922
|
||||
inlined_ast: 207311ab56f2ec438a841db6db558c009b5a74a21a335f83b957f6dd246ca922
|
||||
dce_ast: a6fde2b969db27f40d74709909bb4eb29e5108074b39429000025549838a5273
|
||||
bytecode: 941f89f9872fc4a4cd8657d4ddc9bfe76d332e25cebfb374d29f8f9359ffb4ce
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 74cccc4b0a38262c1b5f3ff921bc6e65a1e4be7d20a7606db75fb0ad9247feb5
|
||||
unrolled_ast: 74cccc4b0a38262c1b5f3ff921bc6e65a1e4be7d20a7606db75fb0ad9247feb5
|
||||
ssa_ast: a20bf82c331521c4535d7ace183a3e124ec6d750933f4fd7b84a26fd83bdeb26
|
||||
flattened_ast: 3729ddec42cd3c551ee5418439016b38c9870b345c3bec6447d76d34041b485e
|
||||
inlined_ast: 3729ddec42cd3c551ee5418439016b38c9870b345c3bec6447d76d34041b485e
|
||||
dce_ast: 0376fbfc629f86ea660c26444614fc8d86d3e237a84dd43050dc1ff407dd925c
|
||||
- - initial_ast: 6b3fa8d416042367bac792f30d3b9f8b6dc91fc985f208956152b97532e26642
|
||||
unrolled_ast: 6b3fa8d416042367bac792f30d3b9f8b6dc91fc985f208956152b97532e26642
|
||||
ssa_ast: 72eebeba1f6a40149ec31a8a52d85ee72afe9997b1c25c3bfb62b1d8e01a1c5a
|
||||
flattened_ast: a994eee165bc14fc461972a8b0b45a75a1069498fc8cf5f05c72b30eb70805f3
|
||||
inlined_ast: a994eee165bc14fc461972a8b0b45a75a1069498fc8cf5f05c72b30eb70805f3
|
||||
dce_ast: 9a55f11504482e734847221e0a80a38541c9625932aa093a488d64514b660175
|
||||
bytecode: b325c77f01ed291126c9b43ecbf54280a09ad0be299ca2aa8698c77af8e4d9bb
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 2a97f22c62b24e3e3cff1c28026e80debcf63ca14a74ce2f79caba895609af54
|
||||
unrolled_ast: 2a97f22c62b24e3e3cff1c28026e80debcf63ca14a74ce2f79caba895609af54
|
||||
ssa_ast: db70af234a7d4bbec042aff2c5b8145271ed413a9eadaab6fca2cb2fe6dee3f0
|
||||
flattened_ast: 35c76809e4fe1b415910f947869d9e5a0c6815277ee941fd7509df43702349b7
|
||||
inlined_ast: 35c76809e4fe1b415910f947869d9e5a0c6815277ee941fd7509df43702349b7
|
||||
dce_ast: 8e5a6527f81828f8a064624af356a985e54bc2a8b17fc50f6404d0ffe0e26bcf
|
||||
- - initial_ast: c4760546fc56254c08ab900e3e94f670cfd178e1e1b078f6a5ffc83cadbc1c5f
|
||||
unrolled_ast: c4760546fc56254c08ab900e3e94f670cfd178e1e1b078f6a5ffc83cadbc1c5f
|
||||
ssa_ast: 3b7100d9818103d05d90878c57bf1ec2cbeb2b60b760a35f52e0dcf74673d16a
|
||||
flattened_ast: 5b9b91bad19337793ac938989de8eb9dd0fb57d5803bd0489779d890a95546e7
|
||||
inlined_ast: 5b9b91bad19337793ac938989de8eb9dd0fb57d5803bd0489779d890a95546e7
|
||||
dce_ast: 103fcf3bfad3b6451e678b1cb6ccfe20aee7bda22d590358b07d88a3aba2a985
|
||||
bytecode: 1838804cfa5f0c1f7a9bb7ba88dc0207faa0e584b0b35bb34cce7091a9178fe9
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 1a4db895daefbae8ac3962a881967d136a81009b35f98a398d862898e2d8b3e9
|
||||
unrolled_ast: 1a4db895daefbae8ac3962a881967d136a81009b35f98a398d862898e2d8b3e9
|
||||
ssa_ast: 0e435286556938d835575fa9e4f5cdbb3258654e83cb2eeff963fd415e3a7d14
|
||||
flattened_ast: 61dbd5483b7ee3a628a9e19314d3c1990e058e4a64503743eb81ede91efc9e1d
|
||||
inlined_ast: 61dbd5483b7ee3a628a9e19314d3c1990e058e4a64503743eb81ede91efc9e1d
|
||||
dce_ast: d3664d33d77760248f0fb95ec48bd27bd3ccf76d7e5bc63da175417784b8aa49
|
||||
- - initial_ast: 48d5be1d1b3c4fb8504ce57800d53999f4a92b4899d809e727a0aec33fca028f
|
||||
unrolled_ast: 48d5be1d1b3c4fb8504ce57800d53999f4a92b4899d809e727a0aec33fca028f
|
||||
ssa_ast: 1f4e9c7d3669da233a2b67191c3d9c7fd8d5ba41f65f9256eda21c45623af813
|
||||
flattened_ast: dcef02c444b2a8482e8212aabc7af7184311ab3126ad2ca963c43488545db5d1
|
||||
inlined_ast: dcef02c444b2a8482e8212aabc7af7184311ab3126ad2ca963c43488545db5d1
|
||||
dce_ast: 9c7963fba2b84ad1c501e3626370b2e8bdab7b4e977cfecc9fe025c0f7affefc
|
||||
bytecode: 03845ec2f54d49f71640659603ead8f68ad067a15fda438e5e13524777d1559b
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: abb7da2055010c29f05a6cb237b0e21da93c9ed8a64ee9aaa4b8bd7e771e5281
|
||||
unrolled_ast: abb7da2055010c29f05a6cb237b0e21da93c9ed8a64ee9aaa4b8bd7e771e5281
|
||||
ssa_ast: 8f0db0111b8b84f1d0db94f08edf2d464b34f9abd829e6c3bb079c5b767931d0
|
||||
flattened_ast: 040f6c6c5422c9a75f51600d811f728715295e2f622a5bb7aaad12f30b0a0db7
|
||||
inlined_ast: 040f6c6c5422c9a75f51600d811f728715295e2f622a5bb7aaad12f30b0a0db7
|
||||
dce_ast: fec28348d3654f5db5789dd3727ec44915de208f3d5dd84aacba07536a0b2e23
|
||||
- - initial_ast: a5ed14e8476fdff1f5fcb5f92e0b5fb2669a33eefdf537489fb73182ee608af4
|
||||
unrolled_ast: a5ed14e8476fdff1f5fcb5f92e0b5fb2669a33eefdf537489fb73182ee608af4
|
||||
ssa_ast: 079195bb127ebf4db1621c06fa8f856a4a751e7a914bddc26961541efaf8ea4c
|
||||
flattened_ast: d7a1868221f871563ef4151a5ec947f2bfc2fb9ae74eb60058134a1c3a503e0f
|
||||
inlined_ast: d7a1868221f871563ef4151a5ec947f2bfc2fb9ae74eb60058134a1c3a503e0f
|
||||
dce_ast: 55410ad47534700121ddd46363864fabe433a9442f81115b4670d7ed85ef4c2d
|
||||
bytecode: ff9bf81abae8332e89f00ebd53dda80528d7a582ade15b2fec53a88a7c5f0532
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: f030d2195ae4734f63d45b6723f0457a91614633bcd13c16b9acb5066ebf6aea
|
||||
unrolled_ast: f030d2195ae4734f63d45b6723f0457a91614633bcd13c16b9acb5066ebf6aea
|
||||
ssa_ast: 8193fef9bd81d561321c13def2fd31371602f909a8d2194fc95d4bc395bde4e6
|
||||
flattened_ast: 407c3d2fabd0d6c9f9c9ca5b68cb827876a5f9a3f45007b857888624922bf143
|
||||
inlined_ast: 407c3d2fabd0d6c9f9c9ca5b68cb827876a5f9a3f45007b857888624922bf143
|
||||
dce_ast: b950d25b2c99ceb0c1e3936a1bd9e06c657aebe53cd244282b0964df020f50c8
|
||||
- - initial_ast: 675fb4ead401c419a7a680811649b363a58356b524f5b08ec7f5569728c99f15
|
||||
unrolled_ast: 675fb4ead401c419a7a680811649b363a58356b524f5b08ec7f5569728c99f15
|
||||
ssa_ast: af736487218bf2fe2b1ca02a0b153b942394888de0c7aff41120f73a9153691f
|
||||
flattened_ast: af8bf4d8a2829319891ddef9c9f1f56a3e051c256a7478c6aadb478e7452f85f
|
||||
inlined_ast: af8bf4d8a2829319891ddef9c9f1f56a3e051c256a7478c6aadb478e7452f85f
|
||||
dce_ast: 83119fda7f384e060c443262a323a15c176b5dc27e74b3bcf30a1e48aa547d28
|
||||
bytecode: 7cbb302c804e8dcb41c04687fe6f45aa748c5b7c0821f3825d21b424a4f89828
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 59c9bca3c22bab046a470ee9de20addce0e590a4fffa37c70c3b5398e5d5025b
|
||||
unrolled_ast: 59c9bca3c22bab046a470ee9de20addce0e590a4fffa37c70c3b5398e5d5025b
|
||||
ssa_ast: 3922e6f40a045944bee4263e6b95264d7a56556f3ee6b7ab56fc0289f662b7dd
|
||||
flattened_ast: f43928a0c5463fd8314ff16d92f49a299d85b1b36ea9304421b6a1276382b7e4
|
||||
inlined_ast: f43928a0c5463fd8314ff16d92f49a299d85b1b36ea9304421b6a1276382b7e4
|
||||
dce_ast: 95fbe88d32e6d94724b8399dd475d27be9ccfc1ff9407f7f7f9e76122b9c7396
|
||||
- - initial_ast: 7dbd33614fc5d7ae3aecb3273e2f9cba1f36b100452b6fbe5e5d46a2e55180f9
|
||||
unrolled_ast: 7dbd33614fc5d7ae3aecb3273e2f9cba1f36b100452b6fbe5e5d46a2e55180f9
|
||||
ssa_ast: d0aa19d9713d3ca3fdec697f4cba37bc7146815af885aeec02294537ad37f006
|
||||
flattened_ast: c5337f7ef66cab33c31de5a2b79301c919995fcb0849b2e917223e466d7a9eef
|
||||
inlined_ast: c5337f7ef66cab33c31de5a2b79301c919995fcb0849b2e917223e466d7a9eef
|
||||
dce_ast: 54bf7ae36ca87deca1c38d5a40b54fce8e7c1f64f638ee0d33ca74d19cee17fb
|
||||
bytecode: 03845ec2f54d49f71640659603ead8f68ad067a15fda438e5e13524777d1559b
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: df8f5863441c322a2820409245aba3f60b1a8bfbbbf8abaeea1840e97c37a924
|
||||
unrolled_ast: df8f5863441c322a2820409245aba3f60b1a8bfbbbf8abaeea1840e97c37a924
|
||||
ssa_ast: 03286477a0e49159658bbe803ac15c55794cb742c50a54de778d85caa44efba1
|
||||
flattened_ast: 7762408bed524328cdb523353a636c393e211c2d7b8a72ca9acc9e8797b4f92f
|
||||
inlined_ast: 7762408bed524328cdb523353a636c393e211c2d7b8a72ca9acc9e8797b4f92f
|
||||
dce_ast: 8cb0d6e1c85fedac617316d0f993e387a1a4a336e7ceb0200afa47bd6af57c25
|
||||
- - initial_ast: 9e1265b1211819172c08be5779b2b0b7e1839a7aa9a88ab6c77243a9a1711345
|
||||
unrolled_ast: 9e1265b1211819172c08be5779b2b0b7e1839a7aa9a88ab6c77243a9a1711345
|
||||
ssa_ast: 8ad36d53ee8e5064346547ccd87488011c18fc6f902ebcb8a13a1b3cba30ba29
|
||||
flattened_ast: bdc6854d758b32202f4928c85f3861398fd11d0f6ec2bd0fac0972fd8e2e6648
|
||||
inlined_ast: bdc6854d758b32202f4928c85f3861398fd11d0f6ec2bd0fac0972fd8e2e6648
|
||||
dce_ast: 800890b1573816d74bc99385d77f42087f7ab4cc0d3c9ee99f26b0259a23b22c
|
||||
bytecode: d5ece61c3e7fb656863858b29941f7947b344a5ff1b4985ae467689f58938553
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: b23d453a014370b531e5e113cd7de76eea72a9bec2ecec6ddcdc2f2e5802af4e
|
||||
unrolled_ast: b23d453a014370b531e5e113cd7de76eea72a9bec2ecec6ddcdc2f2e5802af4e
|
||||
ssa_ast: 0d0a6f58ab24d8777c83bf41e2a7afc9463ebfa38426e8403292576751a9a3d1
|
||||
flattened_ast: 7c0ba0625cfb4d476b9cd4df037c5671498117d4efa6bb4a477071d3cf1e6593
|
||||
inlined_ast: 7c0ba0625cfb4d476b9cd4df037c5671498117d4efa6bb4a477071d3cf1e6593
|
||||
dce_ast: 6de89d2bd96d26fa29b4b3f91679b9247dd0ed8d1d7a0b38c8cc66c38a3c27a5
|
||||
- - initial_ast: c7d38c1c176bd8b4ee26013299187d1008aaa16acfba69945ddcdf17427fc072
|
||||
unrolled_ast: c7d38c1c176bd8b4ee26013299187d1008aaa16acfba69945ddcdf17427fc072
|
||||
ssa_ast: aae6639ac1536f7fd3273f6816dde1d280cd72042aa0942d20f3d7a2e2d770ac
|
||||
flattened_ast: d3eab777e3125479f833194c950ac92ba07e420d36d664ba3636f977e08e2ef5
|
||||
inlined_ast: d3eab777e3125479f833194c950ac92ba07e420d36d664ba3636f977e08e2ef5
|
||||
dce_ast: 0d892639f1f36263305a24bffb22c87bce630bbf0e9bc80b298946e4fa9eb046
|
||||
bytecode: a80b560327138b8bb041f5a6cea148be39bc74dad6a47f45621d207b625a1424
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: bcdd23efde004742b21c1c86bc586086353f781371a13445d48ec4287d668812
|
||||
unrolled_ast: bcdd23efde004742b21c1c86bc586086353f781371a13445d48ec4287d668812
|
||||
ssa_ast: c410257d8d0050eb56ce314f8dd0355812b8e494fd528826c145fac686ac976c
|
||||
flattened_ast: ef9a8c291771afae9381402a3caac98a9102db73471edb755740eb8599a05c53
|
||||
inlined_ast: ef9a8c291771afae9381402a3caac98a9102db73471edb755740eb8599a05c53
|
||||
dce_ast: 766e9f05601c26ee1566d90dec05050304e63d405023d295582717066e12a35d
|
||||
- - initial_ast: a9be315a3445f9f02b64382f5506e9d367f3aeb8f4785df88ff8ac0fadedfc1e
|
||||
unrolled_ast: a9be315a3445f9f02b64382f5506e9d367f3aeb8f4785df88ff8ac0fadedfc1e
|
||||
ssa_ast: 67e4e9c88fa3c8c72856a9a59bb0e3ef9211981ee9a9eef752b1f832cac121f8
|
||||
flattened_ast: 73844e9aa33ebc6a1a878f5d83f652eb89b467c82e8f47b2190820e2b5f52ac4
|
||||
inlined_ast: 73844e9aa33ebc6a1a878f5d83f652eb89b467c82e8f47b2190820e2b5f52ac4
|
||||
dce_ast: 099e7069ae0639e7bafde9cf92773621394f5f1eabf432b12adae16c80e06605
|
||||
bytecode: 319405c8fe80b59376c041f234ae2ef213e2d67b50701412411ac97294f91e69
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 72112481d51ff6b1b77547574dcc342c05fbd068cb1decdbfb9e1faef425fbf3
|
||||
unrolled_ast: 72112481d51ff6b1b77547574dcc342c05fbd068cb1decdbfb9e1faef425fbf3
|
||||
ssa_ast: caae6d971bcf9e9a7aa03b726c4000b0be61c9d5dab67a5a089754eefaf51729
|
||||
flattened_ast: 87e449699d79bb1f1702dc99130172b6fc5419a8869addee67265b08289b9e82
|
||||
inlined_ast: 87e449699d79bb1f1702dc99130172b6fc5419a8869addee67265b08289b9e82
|
||||
dce_ast: d3664d33d77760248f0fb95ec48bd27bd3ccf76d7e5bc63da175417784b8aa49
|
||||
- - initial_ast: 864840baae360688c5aeb76a2a4af4f8928ded1b8b793a3f1e6bc2d39d3bc4c0
|
||||
unrolled_ast: 864840baae360688c5aeb76a2a4af4f8928ded1b8b793a3f1e6bc2d39d3bc4c0
|
||||
ssa_ast: 7870934dbdcf3c11a8e974011343342bb8671474ef2b48c58ae84836b3c66f79
|
||||
flattened_ast: 3c37a03f673a024359a7d233df9aa5ee0c16bcf4bf295953981005c51e4f9059
|
||||
inlined_ast: 3c37a03f673a024359a7d233df9aa5ee0c16bcf4bf295953981005c51e4f9059
|
||||
dce_ast: 9c7963fba2b84ad1c501e3626370b2e8bdab7b4e977cfecc9fe025c0f7affefc
|
||||
bytecode: 03845ec2f54d49f71640659603ead8f68ad067a15fda438e5e13524777d1559b
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 4690101215736bd674057433650e7868ff1aa43ad87205c341fed6c1f25fa621
|
||||
unrolled_ast: 4690101215736bd674057433650e7868ff1aa43ad87205c341fed6c1f25fa621
|
||||
ssa_ast: cfb0a440f009f538e2b66820aed96814020df4d3ed407a3bd7a896ba69ef80d1
|
||||
flattened_ast: ba28ff7cb3928986331a02019073927e6e973fe4676f759cd34994dde2dc4e75
|
||||
inlined_ast: ba28ff7cb3928986331a02019073927e6e973fe4676f759cd34994dde2dc4e75
|
||||
dce_ast: 3ffcd8b2ab5b037042f803c6a0c396a732dcf0e78516c7d86580dac5cec0640a
|
||||
- - initial_ast: 04653e3a6b37c90bb7c9dda51beb7cca18d2752671972ed2c22781453eee1576
|
||||
unrolled_ast: 04653e3a6b37c90bb7c9dda51beb7cca18d2752671972ed2c22781453eee1576
|
||||
ssa_ast: 6232d641a2106324612f574da221c5054bdb86f435d3c56d2b765cda6ffda6fd
|
||||
flattened_ast: 7e1f1830c9a660702409eee8b509584dc724644d8f11888b5d9767fed3e10fb8
|
||||
inlined_ast: 7e1f1830c9a660702409eee8b509584dc724644d8f11888b5d9767fed3e10fb8
|
||||
dce_ast: fe5dc920e6aa68917caf37138b4d00a11a1f9d97ffb4314591855fdf76369950
|
||||
bytecode: 543bce9b35ef6f58454b6f690b9fae8dcf84f639acc37546ef137d8f8e60605c
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: f342b48a009f75911bf75408b5f4a5d50b30a932291c27c04764cc81a0b0e855
|
||||
unrolled_ast: f342b48a009f75911bf75408b5f4a5d50b30a932291c27c04764cc81a0b0e855
|
||||
ssa_ast: 9eb17d21f68e78390498fd934eb26409fda3af1e6812c5a0eecfbf7f47b78d75
|
||||
flattened_ast: 13557bcb68b63b1d1adf4190717cc1c63d0b8a31e6e9634c22a110b475383203
|
||||
inlined_ast: 13557bcb68b63b1d1adf4190717cc1c63d0b8a31e6e9634c22a110b475383203
|
||||
dce_ast: a94d5391be3d212a7fa4c2ff4eac66c10b8ce112c81112129c5fdd74c042f519
|
||||
- - initial_ast: 1ed3c248a1f803e2f43ab6dd1a22847cacee6d2dfa90849281bfde139abb7815
|
||||
unrolled_ast: 1ed3c248a1f803e2f43ab6dd1a22847cacee6d2dfa90849281bfde139abb7815
|
||||
ssa_ast: ef985f04dede16998deb8e67568702ea747c92e5f815d815a87622f7b501d809
|
||||
flattened_ast: 18a771b32fe0ce395b4d0e041d9338bbfb5d822a4df3a80ae17d1ad89c545bb0
|
||||
inlined_ast: 18a771b32fe0ce395b4d0e041d9338bbfb5d822a4df3a80ae17d1ad89c545bb0
|
||||
dce_ast: e928d015f1a718a52c57eb61db26aa288c88fbd3711e7c2a310d6b1520f0d8f0
|
||||
bytecode: 5bf36355b36caa6fcd510f195c79195a7991b45e037c7d6ffe9479f3c2bb89f6
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 6613ab31ae0b1d3537134a6edbcd57cc7f92c67c4fc1e788710853f9117f5f46
|
||||
unrolled_ast: 6613ab31ae0b1d3537134a6edbcd57cc7f92c67c4fc1e788710853f9117f5f46
|
||||
ssa_ast: 423705f1cf9f7ba2b077b93932d3e25e7ed64bf37b79b4da0da194753ed3f596
|
||||
flattened_ast: 7b5298b9966586cab3dc13b55aa0a3c56927aeab16305689fabea63400a1dc29
|
||||
inlined_ast: 7b5298b9966586cab3dc13b55aa0a3c56927aeab16305689fabea63400a1dc29
|
||||
dce_ast: 95fbe88d32e6d94724b8399dd475d27be9ccfc1ff9407f7f7f9e76122b9c7396
|
||||
- - initial_ast: 985487e286f41d77b95e043abaa99a700294acbdea52b026eabc1b403132d46e
|
||||
unrolled_ast: 985487e286f41d77b95e043abaa99a700294acbdea52b026eabc1b403132d46e
|
||||
ssa_ast: d5b506bf41288f39643f9c5caee3b2412ea7ea5eeec3521699cd0444c382e3b1
|
||||
flattened_ast: cccc6852933e40eaf259a903fdd11c2e74c28f8732be6d97c3e3890445c4b393
|
||||
inlined_ast: cccc6852933e40eaf259a903fdd11c2e74c28f8732be6d97c3e3890445c4b393
|
||||
dce_ast: 54bf7ae36ca87deca1c38d5a40b54fce8e7c1f64f638ee0d33ca74d19cee17fb
|
||||
bytecode: 03845ec2f54d49f71640659603ead8f68ad067a15fda438e5e13524777d1559b
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: a796ccc1c063d2b5d8803c7b1c9a51bbc475f39f1572bbfc596391889f711565
|
||||
unrolled_ast: a796ccc1c063d2b5d8803c7b1c9a51bbc475f39f1572bbfc596391889f711565
|
||||
ssa_ast: 7ba4304e1ced648c4846c26f7a655e87e12beafcd267555b29252b74a91fbde5
|
||||
flattened_ast: f8df94c66e381defd5bf5f9c1abc5760e526ab8cbae19baad4518ab31ff9a387
|
||||
inlined_ast: f8df94c66e381defd5bf5f9c1abc5760e526ab8cbae19baad4518ab31ff9a387
|
||||
dce_ast: dce1289e4150bf9ef4808599405d6d1dac49047f568f098afd2508e82fd9f1c9
|
||||
- - initial_ast: c184c3b9dea65d1c9972c6359cb266109146d9d5aeabcb5147d6a551d02edb01
|
||||
unrolled_ast: c184c3b9dea65d1c9972c6359cb266109146d9d5aeabcb5147d6a551d02edb01
|
||||
ssa_ast: 43e04c499f6a7be8b2f5cb861a86d610a124c22627b88c7c314cf581ce3b8247
|
||||
flattened_ast: bbb986a4b40aa8f7240096e02a5e0402d6c7f5bc1dc0722e85a2e118dbd0106f
|
||||
inlined_ast: bbb986a4b40aa8f7240096e02a5e0402d6c7f5bc1dc0722e85a2e118dbd0106f
|
||||
dce_ast: ba1f517261bb11624505c6c2fd49e3f04d942ef2b30d86e3c45334dbd1bbb577
|
||||
bytecode: df6d5bbf5b971b9fbf39786a5bb74b9a26b0ddd9e9bfa501cfc4da9f260de048
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 41c674356da4b1556ab46e400102ce184b3e0afa96c1c233166125dd8d6920aa
|
||||
unrolled_ast: 41c674356da4b1556ab46e400102ce184b3e0afa96c1c233166125dd8d6920aa
|
||||
ssa_ast: 10589598485ceb2123326d998d4ec27bfefdd88057c154287cc49aa13ea0e790
|
||||
flattened_ast: 3f5de4f08882bc509a43051214c170b740a4c9168ec1fe0d95050ca7fbd2c02e
|
||||
inlined_ast: 3f5de4f08882bc509a43051214c170b740a4c9168ec1fe0d95050ca7fbd2c02e
|
||||
dce_ast: 263f4190e148b970b78b419269cc29049e2bf80c5d48cdcf8a8f13fcd8f261a0
|
||||
- - initial_ast: 328daa90b038066e97d5ba5393d4a943414bc500b5237357b9c9e58fc178e51a
|
||||
unrolled_ast: 328daa90b038066e97d5ba5393d4a943414bc500b5237357b9c9e58fc178e51a
|
||||
ssa_ast: 06dbcc5d9abeab1a4e1b417b3b632e14cdd85af3d6c82aebb16d74b2244780cb
|
||||
flattened_ast: cd05234ce579ddc5b36834020949acd415ce59f56a035f0109c8dd886938df20
|
||||
inlined_ast: cd05234ce579ddc5b36834020949acd415ce59f56a035f0109c8dd886938df20
|
||||
dce_ast: 495e6f6dde9ca039e6e55afeb94752bc044b74bf432b9193a7d01926d82e7bbb
|
||||
bytecode: 8e8ad00d8937c7ea19e29fd6e1162957946d6b2c1e90e0ab9b1a4f49a6685a02
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 001673cfc623ee0c053b77d177693d33905b340d239373065a410709345745de
|
||||
unrolled_ast: 001673cfc623ee0c053b77d177693d33905b340d239373065a410709345745de
|
||||
ssa_ast: 25441564a1739ff595a3e7d4ac7b02a651961805b6749cf2cef8a49fa635850d
|
||||
flattened_ast: 065ba80e0fef0c4d93cdb90525eb81715a0126f22257eb0e626a660c5db7931b
|
||||
inlined_ast: 065ba80e0fef0c4d93cdb90525eb81715a0126f22257eb0e626a660c5db7931b
|
||||
dce_ast: 1e2b8ece91ac663046faf35475720ef31708cfb18d1d2c45dc9cab4067be8af1
|
||||
- - initial_ast: 52f0ede29adf2ca4701003a3cd70dc4bbe21848bc68e57ce3ac6d5978731ac96
|
||||
unrolled_ast: 52f0ede29adf2ca4701003a3cd70dc4bbe21848bc68e57ce3ac6d5978731ac96
|
||||
ssa_ast: e9397d32377b970aa46bca1fd809ba0f0845486c39ce945b151932f716b88d9c
|
||||
flattened_ast: 7eb3b7c843218b6b65feac487e6dd1e6319f0076985179c28f871b875b761169
|
||||
inlined_ast: 7eb3b7c843218b6b65feac487e6dd1e6319f0076985179c28f871b875b761169
|
||||
dce_ast: 7fbd1ac636ee91825d1346ff6003c33d2f1eb570952cecca69c68fd12540bc4e
|
||||
bytecode: 4dceb1d3b4f77019d81c7e4d97a5866c6a50147cd8cbc417bb4b6629dc2cbf70
|
||||
warnings: ""
|
||||
|
@ -2,11 +2,11 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- - initial_ast: 3a09b4e460ed49b0bdd97991893f4d4a5244c07f3c828dadc5dfea2e543daa8c
|
||||
unrolled_ast: 3a09b4e460ed49b0bdd97991893f4d4a5244c07f3c828dadc5dfea2e543daa8c
|
||||
ssa_ast: 9ec623673189852a191c13f80d192be2c2ae15c3529879bb8600b12a065b9c28
|
||||
flattened_ast: 4218d69e08b6bdb062757a0690a803843bee31ccd371d8c8543648db1146153d
|
||||
inlined_ast: 4218d69e08b6bdb062757a0690a803843bee31ccd371d8c8543648db1146153d
|
||||
dce_ast: d3664d33d77760248f0fb95ec48bd27bd3ccf76d7e5bc63da175417784b8aa49
|
||||
- - initial_ast: 2619c8fef0b3503b1ae005f38fed58440f146962b20be560332bf395123eee74
|
||||
unrolled_ast: 2619c8fef0b3503b1ae005f38fed58440f146962b20be560332bf395123eee74
|
||||
ssa_ast: 6f7d5a0482b834872e14fb2a3ae867a6f377cfa21f3e71a17ff99ac698ad107d
|
||||
flattened_ast: 13919263c46a63382f0fb34d8c1dbbf67d1a8485b80d2ace5bd8ae50f7a85252
|
||||
inlined_ast: 13919263c46a63382f0fb34d8c1dbbf67d1a8485b80d2ace5bd8ae50f7a85252
|
||||
dce_ast: 9c7963fba2b84ad1c501e3626370b2e8bdab7b4e977cfecc9fe025c0f7affefc
|
||||
bytecode: 03845ec2f54d49f71640659603ead8f68ad067a15fda438e5e13524777d1559b
|
||||
warnings: ""
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user