mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-18 23:02:35 +03:00
Merge pull request #1739 from AleoHQ/feature/add-private-public-inputs
[Impl] handle public inputs and params
This commit is contained in:
commit
7e6eae58c3
@ -20,30 +20,60 @@ use leo_span::Span;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum ParamMode {
|
||||
Const,
|
||||
Private,
|
||||
Public,
|
||||
}
|
||||
|
||||
impl fmt::Display for ParamMode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use ParamMode::*;
|
||||
|
||||
match self {
|
||||
Const => write!(f, "const"),
|
||||
Private => write!(f, "private"),
|
||||
Public => write!(f, "public"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A function parameter.
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct FunctionInputVariable {
|
||||
/// The name the parameter is accessible as in the function's body.
|
||||
pub identifier: Identifier,
|
||||
/// Is it a const parameter?
|
||||
pub const_: bool,
|
||||
/// Is it a mutable parameter?
|
||||
pub mutable: bool,
|
||||
/// The mode of the function parameter.
|
||||
mode: ParamMode,
|
||||
/// What's the parameter's type?
|
||||
pub type_: Type,
|
||||
type_: Type,
|
||||
/// The parameters span from any annotations to its type.
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl FunctionInputVariable {
|
||||
pub fn new(identifier: Identifier, mode: ParamMode, type_: Type, span: Span) -> Self {
|
||||
Self {
|
||||
identifier,
|
||||
mode,
|
||||
type_,
|
||||
span,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mode(&self) -> ParamMode {
|
||||
self.mode
|
||||
}
|
||||
|
||||
pub fn type_(&self) -> Type {
|
||||
self.type_.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl FunctionInputVariable {
|
||||
fn format(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
// mut var: bool
|
||||
if self.const_ {
|
||||
write!(f, "const ")?;
|
||||
}
|
||||
if self.mutable {
|
||||
write!(f, "mut ")?;
|
||||
}
|
||||
write!(f, "{} ", self.mode)?;
|
||||
write!(f, "{}: ", self.identifier)?;
|
||||
write!(f, "{}", self.type_)
|
||||
}
|
||||
|
@ -15,12 +15,13 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::*;
|
||||
use crate::{Expression, Identifier, Type};
|
||||
use crate::{Expression, Identifier, ParamMode, Type};
|
||||
|
||||
/// A single definition inside a section in a state or an input file.
|
||||
/// Definitions should be structured as: `<name>: <type_> = <value>;`
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct Definition {
|
||||
pub mode: ParamMode,
|
||||
pub type_: Type,
|
||||
pub name: Identifier,
|
||||
pub value: Expression,
|
||||
|
@ -21,7 +21,6 @@ use super::*;
|
||||
pub struct ProgramInput {
|
||||
pub main: Definitions,
|
||||
pub registers: Definitions,
|
||||
pub constants: Definitions,
|
||||
}
|
||||
|
||||
impl TryFrom<ParsedInputFile> for ProgramInput {
|
||||
@ -29,20 +28,15 @@ impl TryFrom<ParsedInputFile> for ProgramInput {
|
||||
fn try_from(input: ParsedInputFile) -> Result<Self> {
|
||||
let mut main = IndexMap::new();
|
||||
let mut registers = IndexMap::new();
|
||||
let mut constants = IndexMap::new();
|
||||
|
||||
for section in input.sections {
|
||||
let target = match section.name {
|
||||
sym::main => &mut main,
|
||||
sym::registers => &mut registers,
|
||||
sym::constants => &mut constants,
|
||||
_ => {
|
||||
return Err(InputError::unexpected_section(
|
||||
&["main", "registers", "constants"],
|
||||
section.name,
|
||||
§ion.span,
|
||||
return Err(
|
||||
InputError::unexpected_section(&["main", "registers"], section.name, §ion.span).into(),
|
||||
)
|
||||
.into())
|
||||
}
|
||||
};
|
||||
|
||||
@ -54,10 +48,6 @@ impl TryFrom<ParsedInputFile> for ProgramInput {
|
||||
}
|
||||
}
|
||||
|
||||
Ok(ProgramInput {
|
||||
main,
|
||||
registers,
|
||||
constants,
|
||||
})
|
||||
Ok(ProgramInput { main, registers })
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
variable: &FunctionInputVariable,
|
||||
) -> Result<FunctionInputVariable> {
|
||||
let identifier = self.reduce_identifier(&variable.identifier)?;
|
||||
let type_ = self.reduce_type(&variable.type_, &variable.span)?;
|
||||
let type_ = self.reduce_type(&variable.type_(), &variable.span)?;
|
||||
|
||||
self.reducer.reduce_function_input_variable(variable, identifier, type_)
|
||||
}
|
||||
|
@ -272,13 +272,12 @@ pub trait ReconstructingReducer {
|
||||
identifier: Identifier,
|
||||
type_: Type,
|
||||
) -> Result<FunctionInputVariable> {
|
||||
Ok(FunctionInputVariable {
|
||||
Ok(FunctionInputVariable::new(
|
||||
identifier,
|
||||
const_: variable.const_,
|
||||
mutable: variable.mutable,
|
||||
variable.mode(),
|
||||
type_,
|
||||
span: variable.span.clone(),
|
||||
})
|
||||
variable.span.clone(),
|
||||
))
|
||||
}
|
||||
|
||||
fn reduce_function_input(&mut self, _input: &FunctionInput, new: FunctionInput) -> Result<FunctionInput> {
|
||||
|
@ -36,17 +36,24 @@ pub struct Compiler<'a> {
|
||||
handler: &'a Handler,
|
||||
main_file_path: PathBuf,
|
||||
output_directory: PathBuf,
|
||||
input_file_path: PathBuf,
|
||||
}
|
||||
|
||||
impl<'a> Compiler<'a> {
|
||||
///
|
||||
/// Returns a new Leo compiler.
|
||||
///
|
||||
pub fn new(handler: &'a Handler, main_file_path: PathBuf, output_directory: PathBuf) -> Self {
|
||||
pub fn new(
|
||||
handler: &'a Handler,
|
||||
main_file_path: PathBuf,
|
||||
output_directory: PathBuf,
|
||||
input_file_path: PathBuf,
|
||||
) -> Self {
|
||||
Self {
|
||||
handler,
|
||||
main_file_path,
|
||||
output_directory,
|
||||
input_file_path,
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,6 +77,20 @@ impl<'a> Compiler<'a> {
|
||||
/// Runs the compiler stages.
|
||||
///
|
||||
fn compiler_stages(self) -> Result<leo_ast::Ast> {
|
||||
//load the input file if it exists.
|
||||
let _input_ast = if self.input_file_path.exists() {
|
||||
let input_string = fs::read_to_string(&self.input_file_path)
|
||||
.map_err(|e| CompilerError::file_read_error(self.main_file_path.clone(), e))?;
|
||||
|
||||
Some(leo_parser::parse_input(
|
||||
self.handler,
|
||||
self.input_file_path.to_str().unwrap_or_default(),
|
||||
input_string,
|
||||
)?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
// Load the program file.
|
||||
let program_string = fs::read_to_string(&self.main_file_path)
|
||||
.map_err(|e| CompilerError::file_read_error(self.main_file_path.clone(), e))?;
|
||||
|
@ -1,37 +0,0 @@
|
||||
[package]
|
||||
name = "leo-input"
|
||||
version = "1.5.3"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "Input parser of the Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
repository = "https://github.com/AleoHQ/leo"
|
||||
keywords = [
|
||||
"aleo",
|
||||
"cryptography",
|
||||
"leo",
|
||||
"programming-language",
|
||||
"zero-knowledge"
|
||||
]
|
||||
categories = [ "cryptography::cryptocurrencies", "web-programming" ]
|
||||
include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ]
|
||||
license = "GPL-3.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.56.1"
|
||||
|
||||
[dependencies.from-pest]
|
||||
version = "0.3.1"
|
||||
|
||||
[dependencies.pest]
|
||||
version = "2.0"
|
||||
|
||||
[dependencies.pest-ast]
|
||||
version = "0.3.3"
|
||||
|
||||
[dependencies.pest_derive]
|
||||
version = "2.0"
|
||||
|
||||
[dependencies.thiserror]
|
||||
version = "1.0"
|
||||
|
||||
[dependencies.tracing]
|
||||
version = "0.1"
|
@ -61,12 +61,28 @@ impl ParserContext<'_> {
|
||||
)
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns a [`ParamMode`] AST node if the next tokens represent a function parameter mode.
|
||||
///
|
||||
pub fn parse_function_parameter_mode(&mut self) -> Result<ParamMode> {
|
||||
let public = self.eat(Token::Public);
|
||||
let const_ = self.eat(Token::Const);
|
||||
|
||||
match (public, const_) {
|
||||
(None, Some(_)) => Ok(ParamMode::Const),
|
||||
(None, None) => Ok(ParamMode::Private),
|
||||
(Some(_), None) => Ok(ParamMode::Public),
|
||||
(Some(p), Some(c)) => Err(ParserError::inputs_multiple_variable_types_specified(&(p.span + c.span)).into()),
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns a [`FunctionInput`] AST node if the next tokens represent a function parameter.
|
||||
///
|
||||
pub fn parse_function_parameters(&mut self) -> Result<FunctionInput> {
|
||||
let const_ = self.eat(Token::Const);
|
||||
let mode = self.parse_function_parameter_mode()?;
|
||||
let mutable = self.eat(Token::Mut);
|
||||
|
||||
let name = self.expect_ident()?;
|
||||
|
||||
if let Some(mutable) = &mutable {
|
||||
@ -75,13 +91,12 @@ impl ParserContext<'_> {
|
||||
|
||||
self.expect(Token::Colon)?;
|
||||
let type_ = self.parse_type()?.0;
|
||||
Ok(FunctionInput::Variable(FunctionInputVariable {
|
||||
const_: const_.is_some(),
|
||||
mutable: const_.is_none(),
|
||||
Ok(FunctionInput::Variable(FunctionInputVariable::new(
|
||||
name.clone(),
|
||||
mode,
|
||||
type_,
|
||||
span: name.span.clone(),
|
||||
identifier: name,
|
||||
}))
|
||||
name.span,
|
||||
)))
|
||||
}
|
||||
|
||||
/// Returns an [`(Identifier, Function)`] AST node if the next tokens represent a function name
|
||||
|
@ -49,7 +49,8 @@ impl ParserContext<'_> {
|
||||
let mut definitions = Vec::new();
|
||||
|
||||
while let Some(SpannedToken {
|
||||
token: Token::Ident(_), ..
|
||||
token: Token::Const | Token::Public | Token::Ident(_),
|
||||
..
|
||||
}) = self.peek_option()
|
||||
{
|
||||
definitions.push(self.parse_input_definition()?);
|
||||
@ -66,6 +67,8 @@ impl ParserContext<'_> {
|
||||
/// `<identifier> : <type> = <expression>;`
|
||||
/// Returns [`Definition`].
|
||||
pub fn parse_input_definition(&mut self) -> Result<Definition> {
|
||||
let mode = self.parse_function_parameter_mode()?;
|
||||
|
||||
let name = self.expect_ident()?;
|
||||
self.expect(Token::Colon)?;
|
||||
let (type_, span) = self.parse_type()?;
|
||||
@ -74,6 +77,7 @@ impl ParserContext<'_> {
|
||||
self.expect(Token::Semicolon)?;
|
||||
|
||||
Ok(Definition {
|
||||
mode,
|
||||
name,
|
||||
type_,
|
||||
value,
|
||||
|
@ -57,8 +57,8 @@ pub fn parse(handler: &Handler, path: &str, source: &str) -> Result<Program> {
|
||||
}
|
||||
|
||||
/// Parses an input file at the given file `path` and `source` code text.
|
||||
pub fn parse_input(handler: &Handler, path: &str, source: &str) -> Result<ParsedInputFile> {
|
||||
let mut tokens = ParserContext::new(handler, crate::tokenize(path, source)?);
|
||||
pub fn parse_input<T: AsRef<str>, Y: AsRef<str>>(handler: &Handler, path: T, source: Y) -> Result<ParsedInputFile> {
|
||||
let mut tokens = ParserContext::new(handler, crate::tokenize(path.as_ref(), source.as_ref())?);
|
||||
|
||||
tokens.parse_input()
|
||||
}
|
||||
|
@ -409,6 +409,7 @@ impl Token {
|
||||
"input" => Token::Input,
|
||||
"let" => Token::Let,
|
||||
"mut" => Token::Mut,
|
||||
"public" => Token::Public,
|
||||
"return" => Token::Return,
|
||||
"true" => Token::True,
|
||||
"type" => Token::Type,
|
||||
|
@ -123,6 +123,8 @@ pub enum Token {
|
||||
In,
|
||||
Let,
|
||||
Mut,
|
||||
/// For public inputs.
|
||||
Public,
|
||||
Return,
|
||||
Type,
|
||||
|
||||
@ -153,6 +155,7 @@ pub const KEYWORD_TOKENS: &[Token] = &[
|
||||
Token::Input,
|
||||
Token::Let,
|
||||
Token::Mut,
|
||||
Token::Public,
|
||||
Token::Return,
|
||||
Token::True,
|
||||
Token::Type,
|
||||
@ -193,6 +196,7 @@ impl Token {
|
||||
Token::Input => sym::input,
|
||||
Token::Let => sym::Let,
|
||||
Token::Mut => sym::Mut,
|
||||
Token::Public => sym::Public,
|
||||
Token::Return => sym::Return,
|
||||
Token::True => sym::True,
|
||||
Token::Type => sym::Type,
|
||||
@ -284,6 +288,7 @@ impl fmt::Display for Token {
|
||||
In => write!(f, "in"),
|
||||
Let => write!(f, "let"),
|
||||
Mut => write!(f, "mut"),
|
||||
Public => write!(f, "public"),
|
||||
Return => write!(f, "return"),
|
||||
Type => write!(f, "type"),
|
||||
Eof => write!(f, ""),
|
||||
|
Binary file not shown.
@ -314,7 +314,7 @@ function-declaration = %s"function" identifier
|
||||
|
||||
function-parameters = function-parameter *( "," function-parameter ) [ "," ]
|
||||
|
||||
function-parameter = [ %s"const" ] identifier ":" type
|
||||
function-parameter = [ %s"public" / %s"const" ] identifier ":" type
|
||||
|
||||
declaration = function-declaration
|
||||
|
||||
|
@ -18,6 +18,7 @@ use crate::{commands::Command, context::Context};
|
||||
use leo_compiler::{Ast, Compiler};
|
||||
use leo_errors::{CliError, Result};
|
||||
use leo_package::{
|
||||
inputs::InputFile,
|
||||
// inputs::*,
|
||||
// outputs::CircuitFile
|
||||
outputs::{ChecksumFile, OutputsDirectory, OUTPUTS_DIRECTORY_NAME},
|
||||
@ -147,7 +148,7 @@ impl Command for Build {
|
||||
main_file_path.push(MAIN_FILENAME);
|
||||
|
||||
// Load the input file at `package_name.in`
|
||||
// let (input_string, input_path) = InputFile::new(&package_name).read_from(&path)?;
|
||||
let input_path = InputFile::new(&package_name).setup_file_path(&path);
|
||||
|
||||
// Load the state file at `package_name.in`
|
||||
// let (state_string, state_path) = StateFile::new(&package_name).read_from(&path)?;
|
||||
@ -179,7 +180,7 @@ impl Command for Build {
|
||||
// Initialize error handler
|
||||
let handler = leo_errors::emitter::Handler::default();
|
||||
|
||||
let program = Compiler::new(&handler, main_file_path, output_directory);
|
||||
let program = Compiler::new(&handler, main_file_path, output_directory, input_path.to_path_buf());
|
||||
|
||||
// Compute the current program checksum
|
||||
let program_checksum = program.checksum()?;
|
||||
|
@ -358,4 +358,12 @@ create_errors!(
|
||||
msg: format!("Found the char `{}`, but expected `{}`", found, expected),
|
||||
help: None,
|
||||
}
|
||||
|
||||
/// For when a user specified more than a type on a parameter.
|
||||
@formatted
|
||||
inputs_multiple_variable_types_specified {
|
||||
args: (),
|
||||
msg: "A parameter cannot be both public and const.",
|
||||
help: None,
|
||||
}
|
||||
);
|
||||
|
@ -86,7 +86,7 @@ r0: u32 = 0;
|
||||
)
|
||||
}
|
||||
|
||||
fn setup_file_path<'a>(&self, path: &'a Path) -> Cow<'a, Path> {
|
||||
pub fn setup_file_path<'a>(&self, path: &'a Path) -> Cow<'a, Path> {
|
||||
let mut path = Cow::from(path);
|
||||
if path.is_dir() {
|
||||
if !path.ends_with(INPUTS_DIRECTORY_NAME) {
|
||||
|
@ -131,6 +131,7 @@ symbols! {
|
||||
main,
|
||||
Mut: "mut",
|
||||
prelude,
|
||||
Public,
|
||||
Return: "return",
|
||||
Star: "*",
|
||||
std,
|
||||
|
@ -1,57 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- name: ""
|
||||
expected_input: []
|
||||
import_statements: []
|
||||
imports: {}
|
||||
aliases: {}
|
||||
circuits:
|
||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
||||
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
|
||||
members:
|
||||
- CircuitFunction:
|
||||
annotations: {}
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x() -> Self {\\\"}\"}"
|
||||
input: []
|
||||
const_: false
|
||||
output: SelfType
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
CircuitInit:
|
||||
name: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return Self {};\\\"}\"}"
|
||||
members: []
|
||||
span:
|
||||
line_start: 5
|
||||
line_stop: 5
|
||||
col_start: 16
|
||||
col_stop: 23
|
||||
path: ""
|
||||
content: " return Self {};"
|
||||
span:
|
||||
line_start: 5
|
||||
line_stop: 5
|
||||
col_start: 9
|
||||
col_stop: 23
|
||||
path: ""
|
||||
content: " return Self {};"
|
||||
span:
|
||||
line_start: 4
|
||||
line_stop: 6
|
||||
col_start: 26
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function x() -> Self {\n ...\n }"
|
||||
span:
|
||||
line_start: 4
|
||||
line_stop: 6
|
||||
col_start: 5
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function x() -> Self {\n ...\n }"
|
||||
global_consts: {}
|
||||
functions: {}
|
@ -1,253 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- name: ""
|
||||
expected_input: []
|
||||
import_statements: []
|
||||
imports: {}
|
||||
aliases: {}
|
||||
circuits:
|
||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
||||
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
|
||||
members:
|
||||
- CircuitVariable:
|
||||
- "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x: u32\\\"}\"}"
|
||||
- IntegerType: U32
|
||||
- CircuitFunction:
|
||||
annotations: {}
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function x() { \\\"}\"}"
|
||||
input: []
|
||||
const_: true
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
TupleInit:
|
||||
elements: []
|
||||
span:
|
||||
line_start: 6
|
||||
line_stop: 6
|
||||
col_start: 16
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 6
|
||||
line_stop: 6
|
||||
col_start: 9
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 5
|
||||
line_stop: 7
|
||||
col_start: 24
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function x() { \n ...\n }"
|
||||
span:
|
||||
line_start: 5
|
||||
line_stop: 7
|
||||
col_start: 11
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function x() { \n ...\n }"
|
||||
- CircuitFunction:
|
||||
annotations: {}
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function x(self) { \\\"}\"}"
|
||||
input:
|
||||
- SelfKeyword: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":22,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function x(self) { \\\"}\"}"
|
||||
const_: true
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
TupleInit:
|
||||
elements: []
|
||||
span:
|
||||
line_start: 9
|
||||
line_stop: 9
|
||||
col_start: 16
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 9
|
||||
line_stop: 9
|
||||
col_start: 9
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 8
|
||||
line_stop: 10
|
||||
col_start: 28
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function x(self) { \n ...\n }"
|
||||
span:
|
||||
line_start: 8
|
||||
line_stop: 10
|
||||
col_start: 11
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function x(self) { \n ...\n }"
|
||||
- CircuitFunction:
|
||||
annotations: {}
|
||||
identifier: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function c(const self) { \\\"}\"}"
|
||||
input:
|
||||
- ConstSelfKeyword: "{\"name\":\"const self\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":22,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function c(const self) { \\\"}\"}"
|
||||
const_: true
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
TupleInit:
|
||||
elements: []
|
||||
span:
|
||||
line_start: 12
|
||||
line_stop: 12
|
||||
col_start: 16
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 12
|
||||
line_stop: 12
|
||||
col_start: 9
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 11
|
||||
line_stop: 13
|
||||
col_start: 34
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function c(const self) { \n ...\n }"
|
||||
span:
|
||||
line_start: 11
|
||||
line_stop: 13
|
||||
col_start: 11
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function c(const self) { \n ...\n }"
|
||||
- CircuitFunction:
|
||||
annotations: {}
|
||||
identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, x: u32) {\\\"}\"}"
|
||||
input:
|
||||
- ConstSelfKeyword: "{\"name\":\"const self\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":22,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, x: u32) {\\\"}\"}"
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":34,\\\"col_stop\\\":35,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, x: u32) {\\\"}\"}"
|
||||
const_: false
|
||||
mutable: true
|
||||
type_:
|
||||
IntegerType: U32
|
||||
span:
|
||||
line_start: 14
|
||||
line_stop: 14
|
||||
col_start: 34
|
||||
col_stop: 35
|
||||
path: ""
|
||||
content: " const function b(const self, x: u32) {"
|
||||
const_: true
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
TupleInit:
|
||||
elements: []
|
||||
span:
|
||||
line_start: 15
|
||||
line_stop: 15
|
||||
col_start: 16
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 15
|
||||
line_stop: 15
|
||||
col_start: 9
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 14
|
||||
line_stop: 16
|
||||
col_start: 42
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function b(const self, x: u32) {\n ...\n }"
|
||||
span:
|
||||
line_start: 14
|
||||
line_stop: 16
|
||||
col_start: 11
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function b(const self, x: u32) {\n ...\n }"
|
||||
- CircuitFunction:
|
||||
annotations: {}
|
||||
identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, const x: u32) {\\\"}\"}"
|
||||
input:
|
||||
- ConstSelfKeyword: "{\"name\":\"const self\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":22,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, const x: u32) {\\\"}\"}"
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":40,\\\"col_stop\\\":41,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, const x: u32) {\\\"}\"}"
|
||||
const_: true
|
||||
mutable: false
|
||||
type_:
|
||||
IntegerType: U32
|
||||
span:
|
||||
line_start: 17
|
||||
line_stop: 17
|
||||
col_start: 40
|
||||
col_stop: 41
|
||||
path: ""
|
||||
content: " const function b(const self, const x: u32) {"
|
||||
const_: true
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
TupleInit:
|
||||
elements: []
|
||||
span:
|
||||
line_start: 18
|
||||
line_stop: 18
|
||||
col_start: 16
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 18
|
||||
line_stop: 18
|
||||
col_start: 9
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 17
|
||||
line_stop: 19
|
||||
col_start: 48
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function b(const self, const x: u32) {\n ...\n }"
|
||||
span:
|
||||
line_start: 17
|
||||
line_stop: 19
|
||||
col_start: 11
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function b(const self, const x: u32) {\n ...\n }"
|
||||
global_consts: {}
|
||||
functions: {}
|
@ -1,165 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- name: ""
|
||||
expected_input: []
|
||||
import_statements: []
|
||||
imports: {}
|
||||
aliases: {}
|
||||
circuits:
|
||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
||||
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
|
||||
members:
|
||||
- CircuitConst:
|
||||
- "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const x: u32 = 2;\\\"}\"}"
|
||||
- IntegerType: U32
|
||||
- Value:
|
||||
Implicit:
|
||||
- "2"
|
||||
- span:
|
||||
line_start: 4
|
||||
line_stop: 4
|
||||
col_start: 27
|
||||
col_stop: 28
|
||||
path: ""
|
||||
content: " static const x: u32 = 2;"
|
||||
- CircuitConst:
|
||||
- "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const y: u32 = 5;\\\"}\"}"
|
||||
- IntegerType: U32
|
||||
- Value:
|
||||
Implicit:
|
||||
- "5"
|
||||
- span:
|
||||
line_start: 5
|
||||
line_stop: 5
|
||||
col_start: 27
|
||||
col_stop: 28
|
||||
path: ""
|
||||
content: " static const y: u32 = 5;"
|
||||
- CircuitConst:
|
||||
- "{\"name\":\"G\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const G: u8 = G;\\\"}\"}"
|
||||
- IntegerType: U8
|
||||
- Identifier: "{\"name\":\"G\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const G: u8 = G;\\\"}\"}"
|
||||
- CircuitConst:
|
||||
- "{\"name\":\"FOO\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}"
|
||||
- Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":23,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}"
|
||||
- CircuitInit:
|
||||
name: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":29,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}"
|
||||
members: []
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 7
|
||||
col_start: 29
|
||||
col_stop: 35
|
||||
path: ""
|
||||
content: " static const FOO: Foo = Foo {};"
|
||||
- CircuitConst:
|
||||
- "{\"name\":\"INDEXED\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":18,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}"
|
||||
- Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":27,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}"
|
||||
- Access:
|
||||
Array:
|
||||
array:
|
||||
Identifier: "{\"name\":\"A\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}"
|
||||
index:
|
||||
Value:
|
||||
Implicit:
|
||||
- "0"
|
||||
- span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 35
|
||||
col_stop: 36
|
||||
path: ""
|
||||
content: " static const INDEXED: Foo = A[0];"
|
||||
span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 33
|
||||
col_stop: 37
|
||||
path: ""
|
||||
content: " static const INDEXED: Foo = A[0];"
|
||||
- CircuitConst:
|
||||
- "{\"name\":\"TINDEXED\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":18,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}"
|
||||
- Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":28,\\\"col_stop\\\":31,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}"
|
||||
- Access:
|
||||
Tuple:
|
||||
tuple:
|
||||
Identifier: "{\"name\":\"T\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":34,\\\"col_stop\\\":35,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}"
|
||||
index:
|
||||
value: "0"
|
||||
span:
|
||||
line_start: 9
|
||||
line_stop: 9
|
||||
col_start: 34
|
||||
col_stop: 37
|
||||
path: ""
|
||||
content: " static const TINDEXED: Foo = T.0;"
|
||||
- CircuitConst:
|
||||
- "{\"name\":\"TWO\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TWO: i8 = 1i8 + 1i8;\\\"}\"}"
|
||||
- IntegerType: I8
|
||||
- Binary:
|
||||
left:
|
||||
Value:
|
||||
Integer:
|
||||
- I8
|
||||
- "1"
|
||||
- span:
|
||||
line_start: 10
|
||||
line_stop: 10
|
||||
col_start: 28
|
||||
col_stop: 31
|
||||
path: ""
|
||||
content: " static const TWO: i8 = 1i8 + 1i8;"
|
||||
right:
|
||||
Value:
|
||||
Integer:
|
||||
- I8
|
||||
- "1"
|
||||
- span:
|
||||
line_start: 10
|
||||
line_stop: 10
|
||||
col_start: 34
|
||||
col_stop: 37
|
||||
path: ""
|
||||
content: " static const TWO: i8 = 1i8 + 1i8;"
|
||||
op: Add
|
||||
span:
|
||||
line_start: 10
|
||||
line_stop: 10
|
||||
col_start: 28
|
||||
col_stop: 37
|
||||
path: ""
|
||||
content: " static const TWO: i8 = 1i8 + 1i8;"
|
||||
- CircuitConst:
|
||||
- "{\"name\":\"mult\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":18,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}"
|
||||
- IntegerType: I8
|
||||
- Binary:
|
||||
left:
|
||||
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":29,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}"
|
||||
right:
|
||||
Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}"
|
||||
op: Mul
|
||||
span:
|
||||
line_start: 11
|
||||
line_stop: 11
|
||||
col_start: 29
|
||||
col_stop: 34
|
||||
path: ""
|
||||
content: " static const mult: i8 = x * y;"
|
||||
- CircuitConst:
|
||||
- "{\"name\":\"mult\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":18,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = one();\\\"}\"}"
|
||||
- IntegerType: I8
|
||||
- Call:
|
||||
function:
|
||||
Identifier: "{\"name\":\"one\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":29,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = one();\\\"}\"}"
|
||||
arguments: []
|
||||
span:
|
||||
line_start: 12
|
||||
line_stop: 12
|
||||
col_start: 29
|
||||
col_stop: 34
|
||||
path: ""
|
||||
content: " static const mult: i8 = one();"
|
||||
global_consts: {}
|
||||
functions: {}
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370000]: Function calls not allowed in circuit members.\n --> test:4:27\n |\n 4 | static const x: u32 = foo();\n | ^^^^^"
|
@ -1,15 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- name: ""
|
||||
expected_input: []
|
||||
import_statements: []
|
||||
imports: {}
|
||||
aliases: {}
|
||||
circuits:
|
||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
||||
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
|
||||
members: []
|
||||
global_consts: {}
|
||||
functions: {}
|
@ -1,116 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- name: ""
|
||||
expected_input: []
|
||||
import_statements: []
|
||||
imports: {}
|
||||
aliases: {}
|
||||
circuits:
|
||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
||||
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
|
||||
members:
|
||||
- CircuitConst:
|
||||
- "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const a: u8 = 10;\\\"}\"}"
|
||||
- IntegerType: U8
|
||||
- Value:
|
||||
Implicit:
|
||||
- "10"
|
||||
- span:
|
||||
line_start: 4
|
||||
line_stop: 4
|
||||
col_start: 26
|
||||
col_stop: 28
|
||||
path: ""
|
||||
content: " static const a: u8 = 10;"
|
||||
- CircuitVariable:
|
||||
- "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x: u32,\\\"}\"}"
|
||||
- IntegerType: U32
|
||||
- CircuitVariable:
|
||||
- "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y: u32\\\"}\"}"
|
||||
- IntegerType: U32
|
||||
- CircuitFunction:
|
||||
annotations: {}
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x() {\\\"}\"}"
|
||||
input: []
|
||||
const_: false
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
TupleInit:
|
||||
elements: []
|
||||
span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 16
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 9
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 9
|
||||
col_start: 18
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function x() {\n ...\n }"
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 9
|
||||
col_start: 5
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function x() {\n ...\n }"
|
||||
- CircuitFunction:
|
||||
annotations: {}
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function y() {\\\"}\"}"
|
||||
input: []
|
||||
const_: false
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
TupleInit:
|
||||
elements: []
|
||||
span:
|
||||
line_start: 11
|
||||
line_stop: 11
|
||||
col_start: 16
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 11
|
||||
line_stop: 11
|
||||
col_start: 9
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 10
|
||||
line_stop: 12
|
||||
col_start: 18
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function y() {\n ...\n }"
|
||||
span:
|
||||
line_start: 10
|
||||
line_stop: 12
|
||||
col_start: 5
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function y() {\n ...\n }"
|
||||
global_consts: {}
|
||||
functions: {}
|
@ -1,21 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- name: ""
|
||||
expected_input: []
|
||||
import_statements: []
|
||||
imports: {}
|
||||
aliases: {}
|
||||
circuits:
|
||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
||||
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
|
||||
members:
|
||||
- CircuitVariable:
|
||||
- "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x: u32;\\\"}\"}"
|
||||
- IntegerType: U32
|
||||
- CircuitVariable:
|
||||
- "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y: u32;\\\"}\"}"
|
||||
- IntegerType: U32
|
||||
global_consts: {}
|
||||
functions: {}
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370006]: Cannot mix use of commas and semi-colons for circuit member variable declarations.\n --> test:10:11\n |\n 10 | y: u32;\n | ^\nError [EPAR0370006]: Cannot mix use of commas and semi-colons for circuit member variable declarations.\n --> test:11:5\n |\n 11 | , // recovery witness\n | ^"
|
@ -1,138 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- name: ""
|
||||
expected_input: []
|
||||
import_statements: []
|
||||
imports: {}
|
||||
aliases: {}
|
||||
circuits:
|
||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
||||
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
|
||||
members:
|
||||
- CircuitFunction:
|
||||
annotations: {}
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x() {\\\"}\"}"
|
||||
input: []
|
||||
const_: false
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
TupleInit:
|
||||
elements: []
|
||||
span:
|
||||
line_start: 5
|
||||
line_stop: 5
|
||||
col_start: 16
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 5
|
||||
line_stop: 5
|
||||
col_start: 9
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 4
|
||||
line_stop: 6
|
||||
col_start: 18
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function x() {\n ...\n }"
|
||||
span:
|
||||
line_start: 4
|
||||
line_stop: 6
|
||||
col_start: 5
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function x() {\n ...\n }"
|
||||
- CircuitFunction:
|
||||
annotations: {}
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function y() {\\\"}\"}"
|
||||
input: []
|
||||
const_: false
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
TupleInit:
|
||||
elements: []
|
||||
span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 16
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 9
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 9
|
||||
col_start: 18
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function y() {\n ...\n }"
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 9
|
||||
col_start: 5
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function y() {\n ...\n }"
|
||||
- CircuitFunction:
|
||||
annotations: {}
|
||||
identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function z() {\\\"}\"}"
|
||||
input: []
|
||||
const_: true
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
TupleInit:
|
||||
elements: []
|
||||
span:
|
||||
line_start: 11
|
||||
line_stop: 11
|
||||
col_start: 16
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 11
|
||||
line_stop: 11
|
||||
col_start: 9
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 10
|
||||
line_stop: 12
|
||||
col_start: 24
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function z() {\n ...\n }"
|
||||
span:
|
||||
line_start: 10
|
||||
line_stop: 12
|
||||
col_start: 11
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " const function z() {\n ...\n }"
|
||||
global_consts: {}
|
||||
functions: {}
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370021]: Member functions must come after member variables.\n --> test:7:5\n |\n 7 | foo: u8,\n | ^^^\nError [EPAR0370020]: Member functions must come after member consts.\n --> test:9:18\n |\n 9 | static const BAR: u8 = 0u8;\n | ^^^^^^^^^^^^^\nError [EPAR0370019]: Member variables must come after member consts.\n --> test:15:18\n |\n 15 | static const BAR: u8 = 0u8;\n | ^^^^^^^^^^^^^"
|
@ -1,56 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- name: ""
|
||||
expected_input: []
|
||||
import_statements: []
|
||||
imports: {}
|
||||
aliases: {}
|
||||
circuits:
|
||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
||||
circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}"
|
||||
core_mapping: ~
|
||||
members:
|
||||
- CircuitFunction:
|
||||
annotations: []
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x(mut self) {\\\"}\"}"
|
||||
input:
|
||||
- MutSelfKeyword: "{\"name\":\"mut self\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":16,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x(mut self) {\\\"}\"}"
|
||||
output: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
TupleInit:
|
||||
elements: []
|
||||
span:
|
||||
line_start: 5
|
||||
line_stop: 5
|
||||
col_start: 16
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 5
|
||||
line_stop: 5
|
||||
col_start: 9
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: " return ();"
|
||||
span:
|
||||
line_start: 4
|
||||
line_stop: 6
|
||||
col_start: 26
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function x(mut self) {\n ...\n }"
|
||||
span:
|
||||
line_start: 4
|
||||
line_stop: 6
|
||||
col_start: 5
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: " function x(mut self) {\n ...\n }"
|
||||
global_consts: {}
|
||||
functions: {}
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370018]: `mut self` is no longer accepted. Use `&self` if you would like to pass in a mutable reference to `self`\n --> test:4:16\n |\n 4 | function x(mut self) {\n | ^^^^^^^^"
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user