mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-24 10:41:57 +03:00
imports functioning, next is core imports
This commit is contained in:
parent
14a1125d33
commit
a75dbe38eb
@ -1,90 +0,0 @@
|
|||||||
// Copyright (C) 2019-2021 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/>.
|
|
||||||
|
|
||||||
//! Helper methods for resolving imported packages.
|
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
|
||||||
|
|
||||||
use crate::{AsgContext, Program};
|
|
||||||
use leo_errors::{Result, Span};
|
|
||||||
|
|
||||||
use indexmap::IndexMap;
|
|
||||||
|
|
||||||
pub trait ImportResolver<'a> {
|
|
||||||
fn resolve_package(
|
|
||||||
&mut self,
|
|
||||||
context: AsgContext<'a>,
|
|
||||||
package_segments: &[&str],
|
|
||||||
span: &Span,
|
|
||||||
) -> Result<Option<Program<'a>>>;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct NullImportResolver;
|
|
||||||
|
|
||||||
impl<'a> ImportResolver<'a> for NullImportResolver {
|
|
||||||
fn resolve_package(
|
|
||||||
&mut self,
|
|
||||||
_context: AsgContext<'a>,
|
|
||||||
_package_segments: &[&str],
|
|
||||||
_span: &Span,
|
|
||||||
) -> Result<Option<Program<'a>>> {
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct CoreImportResolver<'a, 'b, T: ImportResolver<'b>> {
|
|
||||||
inner: &'a mut T,
|
|
||||||
lifetime: PhantomData<&'b ()>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'b, T: ImportResolver<'b>> CoreImportResolver<'a, 'b, T> {
|
|
||||||
pub fn new(inner: &'a mut T) -> Self {
|
|
||||||
CoreImportResolver {
|
|
||||||
inner,
|
|
||||||
lifetime: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'b, T: ImportResolver<'b>> ImportResolver<'b> for CoreImportResolver<'a, 'b, T> {
|
|
||||||
fn resolve_package(
|
|
||||||
&mut self,
|
|
||||||
context: AsgContext<'b>,
|
|
||||||
package_segments: &[&str],
|
|
||||||
span: &Span,
|
|
||||||
) -> Result<Option<Program<'b>>> {
|
|
||||||
if !package_segments.is_empty() && package_segments.get(0).unwrap() == &"core" {
|
|
||||||
Ok(crate::resolve_core_module(context, &*package_segments[1..].join("."))?)
|
|
||||||
} else {
|
|
||||||
self.inner.resolve_package(context, package_segments, span)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct MockedImportResolver<'a> {
|
|
||||||
pub packages: IndexMap<String, Program<'a>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> ImportResolver<'a> for MockedImportResolver<'a> {
|
|
||||||
fn resolve_package(
|
|
||||||
&mut self,
|
|
||||||
_context: AsgContext<'a>,
|
|
||||||
package_segments: &[&str],
|
|
||||||
_span: &Span,
|
|
||||||
) -> Result<Option<Program<'a>>> {
|
|
||||||
Ok(self.packages.get(&package_segments.join(".")).cloned())
|
|
||||||
}
|
|
||||||
}
|
|
@ -35,9 +35,6 @@ pub use const_value::*;
|
|||||||
pub mod expression;
|
pub mod expression;
|
||||||
pub use expression::*;
|
pub use expression::*;
|
||||||
|
|
||||||
pub mod import;
|
|
||||||
pub use import::*;
|
|
||||||
|
|
||||||
mod input;
|
mod input;
|
||||||
pub use input::*;
|
pub use input::*;
|
||||||
|
|
||||||
@ -118,7 +115,7 @@ impl<'a> Asg<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO (howardwu): Remove this.
|
// TODO (howardwu): Remove this.
|
||||||
pub fn load_asg<'a, T: ImportResolver<'a>>(
|
/* pub fn load_asg<'a, T: ImportResolver<'a>>(
|
||||||
context: AsgContext<'a>,
|
context: AsgContext<'a>,
|
||||||
content: &str,
|
content: &str,
|
||||||
resolver: &mut T,
|
resolver: &mut T,
|
||||||
@ -127,7 +124,7 @@ pub fn load_asg<'a, T: ImportResolver<'a>>(
|
|||||||
let ast = leo_parser::parse_ast("input.leo", content)?;
|
let ast = leo_parser::parse_ast("input.leo", content)?;
|
||||||
|
|
||||||
Program::new(context, ast.as_repr())
|
Program::new(context, ast.as_repr())
|
||||||
}
|
} */
|
||||||
|
|
||||||
pub fn new_alloc_context<'a>() -> Arena<ArenaNode<'a>> {
|
pub fn new_alloc_context<'a>() -> Arena<ArenaNode<'a>> {
|
||||||
Arena::new()
|
Arena::new()
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
// TODO (protryon): We should merge this with core
|
// TODO (protryon): We should merge this with core
|
||||||
|
|
||||||
use crate::{AsgContext, Program};
|
// use crate::{AsgContext, Program};
|
||||||
use leo_errors::Result;
|
// use leo_errors::Result;
|
||||||
|
|
||||||
// TODO (protryon): Make asg deep copy so we can cache resolved core modules
|
// TODO (protryon): Make asg deep copy so we can cache resolved core modules
|
||||||
// TODO (protryon): Figure out how to do headers without bogus returns
|
// TODO (protryon): Figure out how to do headers without bogus returns
|
||||||
|
|
||||||
pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result<Option<Program<'a>>> {
|
/* pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result<Option<Program<'a>>> {
|
||||||
match module {
|
match module {
|
||||||
"unstable.blake2s" => {
|
"unstable.blake2s" => {
|
||||||
let asg = crate::load_asg(
|
let asg = crate::load_asg(
|
||||||
@ -42,3 +42,4 @@ pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result<
|
|||||||
_ => Ok(None),
|
_ => Ok(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -68,20 +68,10 @@ impl<'a> Program<'a> {
|
|||||||
/// 4. resolve all asg nodes
|
/// 4. resolve all asg nodes
|
||||||
///
|
///
|
||||||
pub fn new(context: AsgContext<'a>, program: &leo_ast::Program) -> Result<Program<'a>> {
|
pub fn new(context: AsgContext<'a>, program: &leo_ast::Program) -> Result<Program<'a>> {
|
||||||
let mut imported_functions: IndexMap<String, &'a Function<'a>> = IndexMap::new();
|
|
||||||
let mut imported_circuits: IndexMap<String, &'a Circuit<'a>> = IndexMap::new();
|
|
||||||
let mut imported_global_consts: IndexMap<String, &'a DefinitionStatement<'a>> = IndexMap::new();
|
|
||||||
let mut imported_modules: IndexMap<String, Program> = IndexMap::new();
|
let mut imported_modules: IndexMap<String, Program> = IndexMap::new();
|
||||||
|
|
||||||
for (name, program) in program.imports.iter() {
|
for (name, program) in program.imports.iter() {
|
||||||
let program = Program::new(context, program)?;
|
imported_modules.insert(name.clone(), Program::new(context, program)?);
|
||||||
|
|
||||||
// TODO only take the ones specified.
|
|
||||||
imported_functions.extend(program.functions.clone());
|
|
||||||
imported_circuits.extend(program.circuits.clone());
|
|
||||||
imported_global_consts.extend(program.global_consts.clone());
|
|
||||||
|
|
||||||
imported_modules.insert(name.clone(), program);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let import_scope = match context.arena.alloc(ArenaNode::Scope(Box::new(Scope {
|
let import_scope = match context.arena.alloc(ArenaNode::Scope(Box::new(Scope {
|
||||||
@ -89,9 +79,9 @@ impl<'a> Program<'a> {
|
|||||||
id: context.get_id(),
|
id: context.get_id(),
|
||||||
parent_scope: Cell::new(None),
|
parent_scope: Cell::new(None),
|
||||||
variables: RefCell::new(IndexMap::new()),
|
variables: RefCell::new(IndexMap::new()),
|
||||||
functions: RefCell::new(imported_functions),
|
functions: RefCell::new(IndexMap::new()),
|
||||||
global_consts: RefCell::new(imported_global_consts),
|
global_consts: RefCell::new(IndexMap::new()),
|
||||||
circuits: RefCell::new(imported_circuits),
|
circuits: RefCell::new(IndexMap::new()),
|
||||||
function: Cell::new(None),
|
function: Cell::new(None),
|
||||||
input: Cell::new(None),
|
input: Cell::new(None),
|
||||||
}))) {
|
}))) {
|
||||||
@ -113,25 +103,22 @@ impl<'a> Program<'a> {
|
|||||||
|
|
||||||
// Prepare header-like scope entries.
|
// Prepare header-like scope entries.
|
||||||
for (name, circuit) in program.circuits.iter() {
|
for (name, circuit) in program.circuits.iter() {
|
||||||
assert_eq!(name.name, circuit.circuit_name.name);
|
|
||||||
let asg_circuit = Circuit::init(scope, circuit)?;
|
let asg_circuit = Circuit::init(scope, circuit)?;
|
||||||
|
|
||||||
scope.circuits.borrow_mut().insert(name.name.to_string(), asg_circuit);
|
scope.circuits.borrow_mut().insert(name.clone(), asg_circuit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second pass for circuit members.
|
// Second pass for circuit members.
|
||||||
for (name, circuit) in program.circuits.iter() {
|
for (name, circuit) in program.circuits.iter() {
|
||||||
assert_eq!(name.name, circuit.circuit_name.name);
|
|
||||||
let asg_circuit = Circuit::init_member(scope, circuit)?;
|
let asg_circuit = Circuit::init_member(scope, circuit)?;
|
||||||
|
|
||||||
scope.circuits.borrow_mut().insert(name.name.to_string(), asg_circuit);
|
scope.circuits.borrow_mut().insert(name.clone(), asg_circuit);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (name, function) in program.functions.iter() {
|
for (name, function) in program.functions.iter() {
|
||||||
assert_eq!(name.name, function.identifier.name);
|
|
||||||
let function = Function::init(scope, function)?;
|
let function = Function::init(scope, function)?;
|
||||||
|
|
||||||
scope.functions.borrow_mut().insert(name.name.to_string(), function);
|
scope.functions.borrow_mut().insert(name.clone(), function);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (name, global_const) in program.global_consts.iter() {
|
for (name, global_const) in program.global_consts.iter() {
|
||||||
@ -159,12 +146,11 @@ impl<'a> Program<'a> {
|
|||||||
|
|
||||||
let mut functions = IndexMap::new();
|
let mut functions = IndexMap::new();
|
||||||
for (name, function) in program.functions.iter() {
|
for (name, function) in program.functions.iter() {
|
||||||
assert_eq!(name.name, function.identifier.name);
|
let asg_function = *scope.functions.borrow().get(name).unwrap();
|
||||||
let asg_function = *scope.functions.borrow().get(name.name.as_ref()).unwrap();
|
|
||||||
|
|
||||||
asg_function.fill_from_ast(function)?;
|
asg_function.fill_from_ast(function)?;
|
||||||
|
|
||||||
let name = name.name.to_string();
|
let name = name.clone();
|
||||||
|
|
||||||
if functions.contains_key(&name) {
|
if functions.contains_key(&name) {
|
||||||
return Err(AsgError::duplicate_function_definition(name, &function.span).into());
|
return Err(AsgError::duplicate_function_definition(name, &function.span).into());
|
||||||
@ -175,12 +161,11 @@ impl<'a> Program<'a> {
|
|||||||
|
|
||||||
let mut circuits = IndexMap::new();
|
let mut circuits = IndexMap::new();
|
||||||
for (name, circuit) in program.circuits.iter() {
|
for (name, circuit) in program.circuits.iter() {
|
||||||
assert_eq!(name.name, circuit.circuit_name.name);
|
let asg_circuit = *scope.circuits.borrow().get(name).unwrap();
|
||||||
let asg_circuit = *scope.circuits.borrow().get(name.name.as_ref()).unwrap();
|
|
||||||
|
|
||||||
asg_circuit.fill_from_ast(circuit)?;
|
asg_circuit.fill_from_ast(circuit)?;
|
||||||
|
|
||||||
circuits.insert(name.name.to_string(), asg_circuit);
|
circuits.insert(name.clone(), asg_circuit);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Program {
|
Ok(Program {
|
||||||
@ -195,9 +180,9 @@ impl<'a> Program<'a> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn set_core_mapping(&self, mapping: &str) {
|
/* pub(crate) fn set_core_mapping(&self, mapping: &str) {
|
||||||
for (_, circuit) in self.circuits.iter() {
|
for (_, circuit) in self.circuits.iter() {
|
||||||
circuit.core_mapping.replace(Some(mapping.to_string()));
|
circuit.core_mapping.replace(Some(mapping.to_string()));
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
}
|
}
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
// Copyright (C) 2019-2021 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/>.
|
|
@ -24,7 +24,6 @@ pub mod definition;
|
|||||||
pub mod field;
|
pub mod field;
|
||||||
pub mod function;
|
pub mod function;
|
||||||
// pub mod group; // we dont do context-specific type checking for groups
|
// pub mod group; // we dont do context-specific type checking for groups
|
||||||
pub mod import;
|
|
||||||
pub mod integers;
|
pub mod integers;
|
||||||
pub mod mutability;
|
pub mod mutability;
|
||||||
pub mod statements;
|
pub mod statements;
|
||||||
|
@ -24,22 +24,13 @@ mod pass;
|
|||||||
const TESTING_FILEPATH: &str = "input.leo";
|
const TESTING_FILEPATH: &str = "input.leo";
|
||||||
|
|
||||||
fn load_asg(program_string: &str) -> Result<Program<'static>, LeoError> {
|
fn load_asg(program_string: &str) -> Result<Program<'static>, LeoError> {
|
||||||
load_asg_imports(make_test_context(), program_string, &mut NullImportResolver)
|
load_asg_imports(make_test_context(), program_string)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_asg_imports<'a, T: ImportResolver<'a>>(
|
fn load_asg_imports<'a>(context: AsgContext<'a>, program_string: &str) -> Result<Program<'a>, LeoError> {
|
||||||
context: AsgContext<'a>,
|
|
||||||
program_string: &str,
|
|
||||||
imports: &mut T,
|
|
||||||
) -> Result<Program<'a>, LeoError> {
|
|
||||||
let mut ast = parse_ast(&TESTING_FILEPATH, program_string)?;
|
let mut ast = parse_ast(&TESTING_FILEPATH, program_string)?;
|
||||||
ast.canonicalize()?;
|
ast.canonicalize()?;
|
||||||
Program::new(context, &ast.as_repr(), imports)
|
Program::new(context, &ast.as_repr())
|
||||||
}
|
|
||||||
|
|
||||||
fn mocked_resolver(_context: AsgContext<'_>) -> MockedImportResolver<'_> {
|
|
||||||
let packages = indexmap::IndexMap::new();
|
|
||||||
MockedImportResolver { packages }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//convenience function for tests, leaks memory
|
//convenience function for tests, leaks memory
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
import test-import.foo as bar;
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
console.assert(bar() == 1u32);
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
import test-import.foo;
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
console.assert(foo() == 1u32);
|
|
||||||
}
|
|
1
asg/tests/pass/import/imports/bar/.gitignore
vendored
1
asg/tests/pass/import/imports/bar/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
output/
|
|
@ -1,3 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "bar"
|
|
||||||
version = "0.1.0"
|
|
@ -1,3 +0,0 @@
|
|||||||
circuit Bat {
|
|
||||||
t: u32;
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
circuit Baz {
|
|
||||||
z: u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
circuit Bazzar {
|
|
||||||
a: u32;
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
circuit Bar {
|
|
||||||
r: u32;
|
|
||||||
}
|
|
1
asg/tests/pass/import/imports/car/.gitignore
vendored
1
asg/tests/pass/import/imports/car/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
output/
|
|
@ -1,3 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "car"
|
|
||||||
version = "0.1.0"
|
|
@ -1,3 +0,0 @@
|
|||||||
circuit Car {
|
|
||||||
c: u32;
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
import test-import.( // local import
|
|
||||||
Point,
|
|
||||||
foo,
|
|
||||||
);
|
|
||||||
|
|
||||||
import bar.( // imports directory import
|
|
||||||
Bar,
|
|
||||||
baz.(Baz, Bazzar),
|
|
||||||
bat.bat.Bat,
|
|
||||||
);
|
|
||||||
|
|
||||||
import car.Car; // imports directory import
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
const point = Point { x: 1u32, y: 1u32 };
|
|
||||||
const foo = foo();
|
|
||||||
|
|
||||||
const bar = Bar { r: 1u32 };
|
|
||||||
const baz = Baz { z: 1u32 };
|
|
||||||
const bazzar = Bazzar { a: 1u32 };
|
|
||||||
const bat = Bat { t: 1u32 };
|
|
||||||
|
|
||||||
const car = Car { c: 1u32 };
|
|
||||||
|
|
||||||
console.assert(car.c == 1u32);
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
import test-import.*; // local import
|
|
||||||
|
|
||||||
import bar.*; // imports directory import
|
|
||||||
import bar.baz.*; // imports directory import
|
|
||||||
import bar.bat.bat.*; // imports directory import
|
|
||||||
import car.*; // imports directory import
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
const point = Point { x: 1u32, y: 1u32 };
|
|
||||||
const foo = foo();
|
|
||||||
|
|
||||||
const bar = Bar { r: 1u32 };
|
|
||||||
const bat = Bat { t: 1u32 };
|
|
||||||
const baz = Baz { z: 1u32 };
|
|
||||||
|
|
||||||
const car = Car { c: 1u32 };
|
|
||||||
|
|
||||||
console.assert(car.c == 1u32);
|
|
||||||
}
|
|
@ -1,154 +0,0 @@
|
|||||||
// Copyright (C) 2019-2021 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::{load_asg, load_asg_imports, make_test_context, mocked_resolver};
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_basic() {
|
|
||||||
let context = make_test_context();
|
|
||||||
let mut imports = mocked_resolver(&context);
|
|
||||||
imports.packages.insert(
|
|
||||||
"test-import".to_string(),
|
|
||||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
let program_string = include_str!("basic.leo");
|
|
||||||
load_asg_imports(&context, program_string, &mut imports).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_multiple() {
|
|
||||||
let context = make_test_context();
|
|
||||||
let mut imports = mocked_resolver(&context);
|
|
||||||
imports.packages.insert(
|
|
||||||
"test-import".to_string(),
|
|
||||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
let program_string = include_str!("multiple.leo");
|
|
||||||
load_asg_imports(&context, program_string, &mut imports).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_star() {
|
|
||||||
let context = make_test_context();
|
|
||||||
let mut imports = mocked_resolver(&context);
|
|
||||||
imports.packages.insert(
|
|
||||||
"test-import".to_string(),
|
|
||||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let program_string = include_str!("star.leo");
|
|
||||||
load_asg_imports(&context, program_string, &mut imports).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_alias() {
|
|
||||||
let context = make_test_context();
|
|
||||||
let mut imports = mocked_resolver(&context);
|
|
||||||
imports.packages.insert(
|
|
||||||
"test-import".to_string(),
|
|
||||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let program_string = include_str!("alias.leo");
|
|
||||||
load_asg_imports(&context, program_string, &mut imports).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
// naming tests
|
|
||||||
#[test]
|
|
||||||
fn test_name() {
|
|
||||||
let context = make_test_context();
|
|
||||||
let mut imports = mocked_resolver(&context);
|
|
||||||
imports.packages.insert(
|
|
||||||
"hello-world".to_string(),
|
|
||||||
load_asg(include_str!("src/hello-world.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
imports
|
|
||||||
.packages
|
|
||||||
.insert("a0-f".to_string(), load_asg(include_str!("src/a0-f.leo")).unwrap());
|
|
||||||
imports
|
|
||||||
.packages
|
|
||||||
.insert("a-9".to_string(), load_asg(include_str!("src/a-9.leo")).unwrap());
|
|
||||||
|
|
||||||
let program_string = include_str!("names.leo");
|
|
||||||
load_asg_imports(&context, program_string, &mut imports).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
// more complex tests
|
|
||||||
#[test]
|
|
||||||
fn test_many_import() {
|
|
||||||
let context = make_test_context();
|
|
||||||
let mut imports = mocked_resolver(&context);
|
|
||||||
imports.packages.insert(
|
|
||||||
"test-import".to_string(),
|
|
||||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
imports.packages.insert(
|
|
||||||
"bar".to_string(),
|
|
||||||
load_asg(include_str!("imports/bar/src/lib.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
imports.packages.insert(
|
|
||||||
"bar.baz".to_string(),
|
|
||||||
load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
imports.packages.insert(
|
|
||||||
"bar.baz".to_string(),
|
|
||||||
load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
imports.packages.insert(
|
|
||||||
"bar.bat.bat".to_string(),
|
|
||||||
load_asg(include_str!("imports/bar/src/bat/bat.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
imports.packages.insert(
|
|
||||||
"car".to_string(),
|
|
||||||
load_asg(include_str!("imports/car/src/lib.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let program_string = include_str!("many_import.leo");
|
|
||||||
load_asg_imports(&context, program_string, &mut imports).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_many_import_star() {
|
|
||||||
let context = make_test_context();
|
|
||||||
let mut imports = mocked_resolver(&context);
|
|
||||||
imports.packages.insert(
|
|
||||||
"test-import".to_string(),
|
|
||||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
imports.packages.insert(
|
|
||||||
"bar".to_string(),
|
|
||||||
load_asg(include_str!("imports/bar/src/lib.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
imports.packages.insert(
|
|
||||||
"bar.baz".to_string(),
|
|
||||||
load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
imports.packages.insert(
|
|
||||||
"bar.baz".to_string(),
|
|
||||||
load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
imports.packages.insert(
|
|
||||||
"bar.bat.bat".to_string(),
|
|
||||||
load_asg(include_str!("imports/bar/src/bat/bat.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
imports.packages.insert(
|
|
||||||
"car".to_string(),
|
|
||||||
load_asg(include_str!("imports/car/src/lib.leo")).unwrap(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let program_string = include_str!("many_import_star.leo");
|
|
||||||
load_asg_imports(&context, program_string, &mut imports).unwrap();
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
import test-import.(
|
|
||||||
Point,
|
|
||||||
foo
|
|
||||||
);
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
const a = Point { x: 1u32, y: 0u32 };
|
|
||||||
|
|
||||||
console.assert(a.x == 1u32);
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
import a0-f.foo;
|
|
||||||
import a-9.bar;
|
|
||||||
import hello-world.hello;
|
|
||||||
|
|
||||||
function main() {}
|
|
@ -1 +0,0 @@
|
|||||||
function bar() {}
|
|
@ -1 +0,0 @@
|
|||||||
function foo() {}
|
|
@ -1 +0,0 @@
|
|||||||
function hello() {}
|
|
@ -1,8 +0,0 @@
|
|||||||
circuit Point {
|
|
||||||
x: u32;
|
|
||||||
y: u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
function foo() -> u32 {
|
|
||||||
return 1u32;
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
import test-import.*;
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
const a = Point { x: 1u32, y: 0u32 };
|
|
||||||
|
|
||||||
console.assert(foo() == 1u32);
|
|
||||||
}
|
|
@ -24,7 +24,6 @@ pub mod definition;
|
|||||||
pub mod field;
|
pub mod field;
|
||||||
pub mod function;
|
pub mod function;
|
||||||
pub mod group;
|
pub mod group;
|
||||||
pub mod import;
|
|
||||||
pub mod input_files;
|
pub mod input_files;
|
||||||
pub mod integers;
|
pub mod integers;
|
||||||
pub mod mutability;
|
pub mod mutability;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
//! A Leo program consists of import, circuit, and function definitions.
|
//! A Leo program consists of import, circuit, and function definitions.
|
||||||
//! Each defined type consists of ast statements and expressions.
|
//! Each defined type consists of ast statements and expressions.
|
||||||
|
|
||||||
use crate::{Circuit, DefinitionStatement, Function, FunctionInput, Identifier, ImportStatement};
|
use crate::{Circuit, DefinitionStatement, Function, FunctionInput, ImportStatement};
|
||||||
|
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -30,9 +30,9 @@ pub struct Program {
|
|||||||
pub expected_input: Vec<FunctionInput>,
|
pub expected_input: Vec<FunctionInput>,
|
||||||
pub import_statements: Vec<ImportStatement>,
|
pub import_statements: Vec<ImportStatement>,
|
||||||
pub imports: IndexMap<String, Program>,
|
pub imports: IndexMap<String, Program>,
|
||||||
pub circuits: IndexMap<Identifier, Circuit>,
|
pub circuits: IndexMap<String, Circuit>,
|
||||||
pub global_consts: IndexMap<String, DefinitionStatement>,
|
pub global_consts: IndexMap<String, DefinitionStatement>,
|
||||||
pub functions: IndexMap<Identifier, Function>,
|
pub functions: IndexMap<String, Function>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsRef<Program> for Program {
|
impl AsRef<Program> for Program {
|
||||||
|
@ -24,9 +24,6 @@ where
|
|||||||
T: ImportResolver,
|
T: ImportResolver,
|
||||||
{
|
{
|
||||||
import_resolver: T,
|
import_resolver: T,
|
||||||
functions_to_import: Vec<(String, Option<String>)>,
|
|
||||||
circuits_to_import: Vec<(String, Option<String>)>,
|
|
||||||
global_consts_to_import: Vec<(String, Option<String>)>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Importer<T>
|
impl<T> Importer<T>
|
||||||
@ -34,12 +31,7 @@ where
|
|||||||
T: ImportResolver,
|
T: ImportResolver,
|
||||||
{
|
{
|
||||||
pub fn new(import_resolver: T) -> Self {
|
pub fn new(import_resolver: T) -> Self {
|
||||||
Self {
|
Self { import_resolver }
|
||||||
import_resolver,
|
|
||||||
functions_to_import: Vec::new(),
|
|
||||||
circuits_to_import: Vec::new(),
|
|
||||||
global_consts_to_import: Vec::new(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +95,7 @@ fn resolve_import_package_access(
|
|||||||
PackageAccess::Multiple(packages) => {
|
PackageAccess::Multiple(packages) => {
|
||||||
package_segments.push(packages.name.name.to_string());
|
package_segments.push(packages.name.name.to_string());
|
||||||
for subaccess in packages.accesses.iter() {
|
for subaccess in packages.accesses.iter() {
|
||||||
resolve_import_package_access(output, package_segments.clone(), &subaccess);
|
resolve_import_package_access(output, package_segments.clone(), subaccess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,12 +117,12 @@ where
|
|||||||
expected_input: Vec<FunctionInput>,
|
expected_input: Vec<FunctionInput>,
|
||||||
import_statements: Vec<ImportStatement>,
|
import_statements: Vec<ImportStatement>,
|
||||||
empty_imports: IndexMap<String, Program>,
|
empty_imports: IndexMap<String, Program>,
|
||||||
circuits: IndexMap<Identifier, Circuit>,
|
mut circuits: IndexMap<String, Circuit>,
|
||||||
functions: IndexMap<Identifier, Function>,
|
mut functions: IndexMap<String, Function>,
|
||||||
global_consts: IndexMap<String, DefinitionStatement>,
|
mut global_consts: IndexMap<String, DefinitionStatement>,
|
||||||
) -> Result<Program> {
|
) -> Result<Program> {
|
||||||
if !empty_imports.is_empty() {
|
if !empty_imports.is_empty() {
|
||||||
// TODO THROW ERR
|
// TODO THROW ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut imported_symbols: Vec<(Vec<String>, ImportSymbol, Span)> = vec![];
|
let mut imported_symbols: Vec<(Vec<String>, ImportSymbol, Span)> = vec![];
|
||||||
@ -149,6 +141,7 @@ where
|
|||||||
for (package, span) in deduplicated_imports {
|
for (package, span) in deduplicated_imports {
|
||||||
let _pretty_package = package.join(".");
|
let _pretty_package = package.join(".");
|
||||||
|
|
||||||
|
// TODO FIX ERROR
|
||||||
let resolved_package =
|
let resolved_package =
|
||||||
match wrapped_resolver.resolve_package(&package.iter().map(|x| &**x).collect::<Vec<_>>()[..], &span)? {
|
match wrapped_resolver.resolve_package(&package.iter().map(|x| &**x).collect::<Vec<_>>()[..], &span)? {
|
||||||
Some(x) => x,
|
Some(x) => x,
|
||||||
@ -158,35 +151,43 @@ where
|
|||||||
resolved_packages.insert(package.clone(), resolved_package);
|
resolved_packages.insert(package.clone(), resolved_package);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Errors
|
// TODO ERROR
|
||||||
// TODO copyable AST.
|
// TODO copyable AST.
|
||||||
// TODO should imports be renamed in imported program?
|
|
||||||
for (package, symbol, span) in imported_symbols.into_iter() {
|
for (package, symbol, span) in imported_symbols.into_iter() {
|
||||||
let _pretty_package = package.join(".");
|
let _pretty_package = package.join(".");
|
||||||
|
|
||||||
let resolved_package = resolved_packages
|
let resolved_package = resolved_packages
|
||||||
.get_mut(&package)
|
.get_mut(&package)
|
||||||
.expect("could not find preloaded package");
|
.expect("could not find preloaded package");
|
||||||
|
|
||||||
match symbol {
|
match symbol {
|
||||||
ImportSymbol::Alias(name, alias) => {
|
ImportSymbol::All => {
|
||||||
let lookup_ident = Identifier::new(name.clone().into());
|
functions.extend(resolved_package.functions.clone().into_iter());
|
||||||
if let Some((ident, function)) = resolved_package.functions.remove_entry(&lookup_ident) {
|
circuits.extend(resolved_package.circuits.clone().into_iter());
|
||||||
let mut alias_identifier = ident.clone();
|
global_consts.extend(resolved_package.global_consts.clone().into_iter());
|
||||||
alias_identifier.name = alias.into();
|
}
|
||||||
resolved_package.functions.insert(alias_identifier, function.clone());
|
ImportSymbol::Direct(name) => {
|
||||||
} else if let Some((ident, circuit)) = resolved_package.circuits.remove_entry(&lookup_ident) {
|
if let Some(function) = resolved_package.functions.get(&name) {
|
||||||
let mut alias_identifier = ident.clone();
|
functions.insert(name.clone(), function.clone());
|
||||||
alias_identifier.name = alias.into();
|
} else if let Some(circuit) = resolved_package.circuits.get(&name) {
|
||||||
resolved_package.circuits.insert(alias_identifier, circuit.clone());
|
circuits.insert(name.clone(), circuit.clone());
|
||||||
} else if let Some(global_const) = resolved_package.global_consts.remove(&name) {
|
} else if let Some(global_const) = resolved_package.global_consts.get(&name) {
|
||||||
resolved_package
|
global_consts.insert(name.clone(), global_const.clone());
|
||||||
.global_consts
|
} else {
|
||||||
.insert(alias.clone(), global_const.clone());
|
return Err(AstError::empty_string(&span).into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImportSymbol::Alias(name, alias) => {
|
||||||
|
if let Some(function) = resolved_package.functions.get(&name) {
|
||||||
|
functions.insert(alias.clone(), function.clone());
|
||||||
|
} else if let Some(circuit) = resolved_package.circuits.get(&name) {
|
||||||
|
circuits.insert(alias.clone(), circuit.clone());
|
||||||
|
} else if let Some(global_const) = resolved_package.global_consts.get(&name) {
|
||||||
|
global_consts.insert(alias.clone(), global_const.clone());
|
||||||
} else {
|
} else {
|
||||||
return Err(AstError::empty_string(&span).into());
|
return Err(AstError::empty_string(&span).into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,14 +428,14 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
|||||||
|
|
||||||
let mut circuits = IndexMap::new();
|
let mut circuits = IndexMap::new();
|
||||||
self.reducer.swap_in_circuit();
|
self.reducer.swap_in_circuit();
|
||||||
for (identifier, circuit) in program.circuits.iter() {
|
for (name, circuit) in program.circuits.iter() {
|
||||||
circuits.insert(self.reduce_identifier(identifier)?, self.reduce_circuit(circuit)?);
|
circuits.insert(name.clone(), self.reduce_circuit(circuit)?);
|
||||||
}
|
}
|
||||||
self.reducer.swap_in_circuit();
|
self.reducer.swap_in_circuit();
|
||||||
|
|
||||||
let mut functions = IndexMap::new();
|
let mut functions = IndexMap::new();
|
||||||
for (identifier, function) in program.functions.iter() {
|
for (name, function) in program.functions.iter() {
|
||||||
functions.insert(self.reduce_identifier(identifier)?, self.reduce_function(function)?);
|
functions.insert(name.clone(), self.reduce_function(function)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut global_consts = IndexMap::new();
|
let mut global_consts = IndexMap::new();
|
||||||
|
@ -374,6 +374,7 @@ pub trait ReconstructingReducer {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
// Program
|
// Program
|
||||||
fn reduce_program(
|
fn reduce_program(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -381,8 +382,8 @@ pub trait ReconstructingReducer {
|
|||||||
expected_input: Vec<FunctionInput>,
|
expected_input: Vec<FunctionInput>,
|
||||||
import_statements: Vec<ImportStatement>,
|
import_statements: Vec<ImportStatement>,
|
||||||
imports: IndexMap<String, Program>,
|
imports: IndexMap<String, Program>,
|
||||||
circuits: IndexMap<Identifier, Circuit>,
|
circuits: IndexMap<String, Circuit>,
|
||||||
functions: IndexMap<Identifier, Function>,
|
functions: IndexMap<String, Function>,
|
||||||
global_consts: IndexMap<String, DefinitionStatement>,
|
global_consts: IndexMap<String, DefinitionStatement>,
|
||||||
) -> Result<Program> {
|
) -> Result<Program> {
|
||||||
Ok(Program {
|
Ok(Program {
|
||||||
|
@ -242,6 +242,10 @@ impl<'a, F: PrimeField, G: GroupType<F>> Compiler<'a, F, G> {
|
|||||||
// Preform import resolution.
|
// Preform import resolution.
|
||||||
ast.importer(leo_imports::ImportParser::new(self.main_file_path.clone()))?;
|
ast.importer(leo_imports::ImportParser::new(self.main_file_path.clone()))?;
|
||||||
|
|
||||||
|
if self.ast_snapshot_options.imports_resolved {
|
||||||
|
ast.to_json_file(self.output_directory.clone(), "imports_resolved.json")?;
|
||||||
|
}
|
||||||
|
|
||||||
// Preform canonicalization of AST always.
|
// Preform canonicalization of AST always.
|
||||||
ast.canonicalize()?;
|
ast.canonicalize()?;
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ impl Default for CompilerOptions {
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct AstSnapshotOptions {
|
pub struct AstSnapshotOptions {
|
||||||
pub initial: bool,
|
pub initial: bool,
|
||||||
|
pub imports_resolved: bool,
|
||||||
pub canonicalized: bool,
|
pub canonicalized: bool,
|
||||||
pub type_inferenced: bool,
|
pub type_inferenced: bool,
|
||||||
}
|
}
|
||||||
@ -46,6 +47,7 @@ impl Default for AstSnapshotOptions {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
initial: false,
|
initial: false,
|
||||||
|
imports_resolved: false,
|
||||||
canonicalized: false,
|
canonicalized: false,
|
||||||
type_inferenced: false,
|
type_inferenced: false,
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,7 @@ struct CompileOutput {
|
|||||||
pub circuit: SummarizedCircuit,
|
pub circuit: SummarizedCircuit,
|
||||||
pub output: Vec<OutputItem>,
|
pub output: Vec<OutputItem>,
|
||||||
pub initial_ast: String,
|
pub initial_ast: String,
|
||||||
|
pub imports_resolved_ast: String,
|
||||||
pub canonicalized_ast: String,
|
pub canonicalized_ast: String,
|
||||||
pub type_inferenced_ast: String,
|
pub type_inferenced_ast: String,
|
||||||
}
|
}
|
||||||
@ -113,6 +114,7 @@ impl Namespace for CompileNamespace {
|
|||||||
&test.content,
|
&test.content,
|
||||||
Some(AstSnapshotOptions {
|
Some(AstSnapshotOptions {
|
||||||
initial: true,
|
initial: true,
|
||||||
|
imports_resolved: true,
|
||||||
canonicalized: true,
|
canonicalized: true,
|
||||||
type_inferenced: true,
|
type_inferenced: true,
|
||||||
}),
|
}),
|
||||||
@ -209,19 +211,25 @@ impl Namespace for CompileNamespace {
|
|||||||
|
|
||||||
let initial_ast: String = hash(
|
let initial_ast: String = hash(
|
||||||
Ast::from_json_file("/tmp/output/initial_ast.json".into())
|
Ast::from_json_file("/tmp/output/initial_ast.json".into())
|
||||||
.unwrap_or_else(|_| Ast::new(Program::new("Error reading initial theorem.".to_string())))
|
.unwrap_or_else(|_| Ast::new(Program::new("Error reading initial snapshot.".to_string())))
|
||||||
|
.to_json_string()
|
||||||
|
.unwrap_or_else(|_| "Error converting ast to string.".to_string()),
|
||||||
|
);
|
||||||
|
let imports_resolved_ast: String = hash(
|
||||||
|
Ast::from_json_file("/tmp/output/imports_resolved_ast.json".into())
|
||||||
|
.unwrap_or_else(|_| Ast::new(Program::new("Error reading imports resolved snapshot.".to_string())))
|
||||||
.to_json_string()
|
.to_json_string()
|
||||||
.unwrap_or_else(|_| "Error converting ast to string.".to_string()),
|
.unwrap_or_else(|_| "Error converting ast to string.".to_string()),
|
||||||
);
|
);
|
||||||
let canonicalized_ast: String = hash(
|
let canonicalized_ast: String = hash(
|
||||||
Ast::from_json_file("/tmp/output/canonicalization_ast.json".into())
|
Ast::from_json_file("/tmp/output/canonicalization_ast.json".into())
|
||||||
.unwrap_or_else(|_| Ast::new(Program::new("Error reading canonicalized theorem.".to_string())))
|
.unwrap_or_else(|_| Ast::new(Program::new("Error reading canonicalized snapshot.".to_string())))
|
||||||
.to_json_string()
|
.to_json_string()
|
||||||
.unwrap_or_else(|_| "Error converting ast to string.".to_string()),
|
.unwrap_or_else(|_| "Error converting ast to string.".to_string()),
|
||||||
);
|
);
|
||||||
let type_inferenced_ast = hash(
|
let type_inferenced_ast = hash(
|
||||||
Ast::from_json_file("/tmp/output/type_inferenced_ast.json".into())
|
Ast::from_json_file("/tmp/output/type_inferenced_ast.json".into())
|
||||||
.unwrap_or_else(|_| Ast::new(Program::new("Error reading type inferenced theorem.".to_string())))
|
.unwrap_or_else(|_| Ast::new(Program::new("Error reading type inferenced snapshot.".to_string())))
|
||||||
.to_json_string()
|
.to_json_string()
|
||||||
.unwrap_or_else(|_| "Error converting ast to string.".to_string()),
|
.unwrap_or_else(|_| "Error converting ast to string.".to_string()),
|
||||||
);
|
);
|
||||||
@ -234,6 +242,7 @@ impl Namespace for CompileNamespace {
|
|||||||
circuit: last_circuit.unwrap(),
|
circuit: last_circuit.unwrap(),
|
||||||
output: output_items,
|
output: output_items,
|
||||||
initial_ast,
|
initial_ast,
|
||||||
|
imports_resolved_ast,
|
||||||
canonicalized_ast,
|
canonicalized_ast,
|
||||||
type_inferenced_ast,
|
type_inferenced_ast,
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::ImportParser;
|
use crate::ImportParser;
|
||||||
use leo_ast::{Identifier, ImportResolver, Program};
|
use leo_ast::Program;
|
||||||
use leo_errors::{ImportError, Result, Span};
|
use leo_errors::{ImportError, Result, Span};
|
||||||
|
|
||||||
use std::{fs, fs::DirEntry, path::PathBuf};
|
use std::{fs, fs::DirEntry, path::PathBuf};
|
||||||
|
@ -47,6 +47,8 @@ pub struct BuildOptions {
|
|||||||
pub enable_all_ast_snapshots: bool,
|
pub enable_all_ast_snapshots: bool,
|
||||||
#[structopt(long, help = "Writes AST snapshot of the initial parse.")]
|
#[structopt(long, help = "Writes AST snapshot of the initial parse.")]
|
||||||
pub enable_initial_ast_snapshot: bool,
|
pub enable_initial_ast_snapshot: bool,
|
||||||
|
#[structopt(long, help = "Writes AST snapshot after the import resolution phase.")]
|
||||||
|
pub enable_imports_resolved_ast_snapshot: bool,
|
||||||
#[structopt(long, help = "Writes AST snapshot after the canonicalization phase.")]
|
#[structopt(long, help = "Writes AST snapshot after the canonicalization phase.")]
|
||||||
pub enable_canonicalized_ast_snapshot: bool,
|
pub enable_canonicalized_ast_snapshot: bool,
|
||||||
#[structopt(long, help = "Writes AST snapshot after the type inference phase.")]
|
#[structopt(long, help = "Writes AST snapshot after the type inference phase.")]
|
||||||
@ -61,6 +63,7 @@ impl Default for BuildOptions {
|
|||||||
disable_all_optimizations: true,
|
disable_all_optimizations: true,
|
||||||
enable_all_ast_snapshots: false,
|
enable_all_ast_snapshots: false,
|
||||||
enable_initial_ast_snapshot: false,
|
enable_initial_ast_snapshot: false,
|
||||||
|
enable_imports_resolved_ast_snapshot: false,
|
||||||
enable_canonicalized_ast_snapshot: false,
|
enable_canonicalized_ast_snapshot: false,
|
||||||
enable_type_inferenced_ast_snapshot: false,
|
enable_type_inferenced_ast_snapshot: false,
|
||||||
}
|
}
|
||||||
@ -88,12 +91,14 @@ impl From<BuildOptions> for AstSnapshotOptions {
|
|||||||
if options.enable_all_ast_snapshots {
|
if options.enable_all_ast_snapshots {
|
||||||
AstSnapshotOptions {
|
AstSnapshotOptions {
|
||||||
initial: true,
|
initial: true,
|
||||||
|
imports_resolved: true,
|
||||||
canonicalized: true,
|
canonicalized: true,
|
||||||
type_inferenced: true,
|
type_inferenced: true,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AstSnapshotOptions {
|
AstSnapshotOptions {
|
||||||
initial: options.enable_initial_ast_snapshot,
|
initial: options.enable_initial_ast_snapshot,
|
||||||
|
imports_resolved: options.enable_imports_resolved_ast_snapshot,
|
||||||
canonicalized: options.enable_canonicalized_ast_snapshot,
|
canonicalized: options.enable_canonicalized_ast_snapshot,
|
||||||
type_inferenced: options.enable_type_inferenced_ast_snapshot,
|
type_inferenced: options.enable_type_inferenced_ast_snapshot,
|
||||||
}
|
}
|
||||||
|
@ -402,14 +402,14 @@ impl ParserContext {
|
|||||||
/// Returns an [`(Identifier, Circuit)`] tuple of AST nodes if the next tokens represent a
|
/// Returns an [`(Identifier, Circuit)`] tuple of AST nodes if the next tokens represent a
|
||||||
/// circuit name and definition statement.
|
/// circuit name and definition statement.
|
||||||
///
|
///
|
||||||
pub fn parse_circuit(&mut self) -> Result<(Identifier, Circuit)> {
|
pub fn parse_circuit(&mut self) -> Result<(String, Circuit)> {
|
||||||
self.expect(Token::Circuit)?;
|
self.expect(Token::Circuit)?;
|
||||||
let name = self.expect_ident()?;
|
let name = self.expect_ident()?;
|
||||||
self.expect(Token::LeftCurly)?;
|
self.expect(Token::LeftCurly)?;
|
||||||
let members = self.parse_circuit_declaration()?;
|
let members = self.parse_circuit_declaration()?;
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
name.clone(),
|
name.name.to_string(),
|
||||||
Circuit {
|
Circuit {
|
||||||
circuit_name: name,
|
circuit_name: name,
|
||||||
members,
|
members,
|
||||||
@ -466,7 +466,7 @@ impl ParserContext {
|
|||||||
/// Returns an [`(Identifier, Function)`] AST node if the next tokens represent a function name
|
/// Returns an [`(Identifier, Function)`] AST node if the next tokens represent a function name
|
||||||
/// and function definition.
|
/// and function definition.
|
||||||
///
|
///
|
||||||
pub fn parse_function_declaration(&mut self) -> Result<(Identifier, Function)> {
|
pub fn parse_function_declaration(&mut self) -> Result<(String, Function)> {
|
||||||
let mut annotations = Vec::new();
|
let mut annotations = Vec::new();
|
||||||
while self.peek_token().as_ref() == &Token::At {
|
while self.peek_token().as_ref() == &Token::At {
|
||||||
annotations.push(self.parse_annotation()?);
|
annotations.push(self.parse_annotation()?);
|
||||||
@ -490,7 +490,7 @@ impl ParserContext {
|
|||||||
};
|
};
|
||||||
let block = self.parse_block()?;
|
let block = self.parse_block()?;
|
||||||
Ok((
|
Ok((
|
||||||
name.clone(),
|
name.name.to_string(),
|
||||||
Function {
|
Function {
|
||||||
annotations,
|
annotations,
|
||||||
identifier: name,
|
identifier: name,
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "",
|
"name": "",
|
||||||
"expected_input": [],
|
"expected_input": [],
|
||||||
"imports": [],
|
"import_statements": [],
|
||||||
|
"imports": {},
|
||||||
"circuits": {},
|
"circuits": {},
|
||||||
"global_consts": {},
|
"global_consts": {},
|
||||||
"functions": {
|
"functions": {
|
||||||
"{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function main() {\\\"}\"}": {
|
"main": {
|
||||||
"annotations": [],
|
"annotations": [],
|
||||||
"identifier": "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function main() {\\\"}\"}",
|
"identifier": "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"C:\\\\\\\\Users\\\\\\\\jonat\\\\\\\\AppData\\\\\\\\Roaming\\\\\\\\work\\\\\\\\tester\\\\\\\\src/main.leo\\\",\\\"content\\\":\\\"function main() -> u8 {\\\"}\"}",
|
||||||
"input": [],
|
"input": [],
|
||||||
"output": null,
|
"output": {
|
||||||
|
"IntegerType": "U8"
|
||||||
|
},
|
||||||
"block": {
|
"block": {
|
||||||
"statements": [
|
"statements": [
|
||||||
{
|
{
|
||||||
@ -18,30 +21,32 @@
|
|||||||
"Binary": {
|
"Binary": {
|
||||||
"left": {
|
"left": {
|
||||||
"Value": {
|
"Value": {
|
||||||
"Implicit": [
|
"Integer": [
|
||||||
|
"U8",
|
||||||
"1",
|
"1",
|
||||||
{
|
{
|
||||||
"line_start": 2,
|
"line_start": 2,
|
||||||
"line_stop": 2,
|
"line_stop": 2,
|
||||||
"col_start": 12,
|
"col_start": 12,
|
||||||
"col_stop": 13,
|
"col_stop": 15,
|
||||||
"path": "test",
|
"path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo",
|
||||||
"content": " return 1 + 1"
|
"content": " return 1u8 + 1u8;"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"right": {
|
"right": {
|
||||||
"Value": {
|
"Value": {
|
||||||
"Implicit": [
|
"Integer": [
|
||||||
|
"U8",
|
||||||
"1",
|
"1",
|
||||||
{
|
{
|
||||||
"line_start": 2,
|
"line_start": 2,
|
||||||
"line_stop": 2,
|
"line_stop": 2,
|
||||||
"col_start": 16,
|
"col_start": 18,
|
||||||
"col_stop": 17,
|
"col_stop": 21,
|
||||||
"path": "test",
|
"path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo",
|
||||||
"content": " return 1 + 1"
|
"content": " return 1u8 + 1u8;"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -51,9 +56,9 @@
|
|||||||
"line_start": 2,
|
"line_start": 2,
|
||||||
"line_stop": 2,
|
"line_stop": 2,
|
||||||
"col_start": 12,
|
"col_start": 12,
|
||||||
"col_stop": 17,
|
"col_stop": 21,
|
||||||
"path": "test",
|
"path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo",
|
||||||
"content": " return 1 + 1"
|
"content": " return 1u8 + 1u8;"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -61,9 +66,9 @@
|
|||||||
"line_start": 2,
|
"line_start": 2,
|
||||||
"line_stop": 2,
|
"line_stop": 2,
|
||||||
"col_start": 5,
|
"col_start": 5,
|
||||||
"col_stop": 17,
|
"col_stop": 21,
|
||||||
"path": "test",
|
"path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo",
|
||||||
"content": " return 1 + 1"
|
"content": " return 1u8 + 1u8;"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,10 +76,10 @@
|
|||||||
"span": {
|
"span": {
|
||||||
"line_start": 1,
|
"line_start": 1,
|
||||||
"line_stop": 3,
|
"line_stop": 3,
|
||||||
"col_start": 17,
|
"col_start": 23,
|
||||||
"col_stop": 2,
|
"col_stop": 2,
|
||||||
"path": "test",
|
"path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo",
|
||||||
"content": "function main() {\n...\n}"
|
"content": "function main() -> u8 {\n ...\n}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"span": {
|
"span": {
|
||||||
@ -82,8 +87,8 @@
|
|||||||
"line_stop": 3,
|
"line_stop": 3,
|
||||||
"col_start": 1,
|
"col_start": 1,
|
||||||
"col_stop": 2,
|
"col_stop": 2,
|
||||||
"path": "test",
|
"path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo",
|
||||||
"content": "function main() {\n...\n}"
|
"content": "function main() -> u8 {\n ...\n}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
function main() {
|
function main() {
|
||||||
return 1 + 1;
|
return 1u8 + 1u8;
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,10 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits:
|
circuits:
|
||||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
X:
|
||||||
circuit_name: "{\"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:
|
members:
|
||||||
- CircuitFunction:
|
- CircuitFunction:
|
||||||
|
@ -4,9 +4,10 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits:
|
circuits:
|
||||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
X:
|
||||||
circuit_name: "{\"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: []
|
members: []
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
|
@ -4,9 +4,10 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits:
|
circuits:
|
||||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
X:
|
||||||
circuit_name: "{\"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:
|
members:
|
||||||
- CircuitVariable:
|
- CircuitVariable:
|
||||||
|
@ -4,9 +4,10 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits:
|
circuits:
|
||||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
X:
|
||||||
circuit_name: "{\"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:
|
members:
|
||||||
- CircuitVariable:
|
- CircuitVariable:
|
||||||
|
@ -4,9 +4,10 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits:
|
circuits:
|
||||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
X:
|
||||||
circuit_name: "{\"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:
|
members:
|
||||||
- CircuitFunction:
|
- CircuitFunction:
|
||||||
|
@ -4,9 +4,10 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits:
|
circuits:
|
||||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
X:
|
||||||
circuit_name: "{\"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:
|
members:
|
||||||
- CircuitFunction:
|
- CircuitFunction:
|
||||||
|
@ -4,9 +4,10 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits:
|
circuits:
|
||||||
"{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}":
|
X:
|
||||||
circuit_name: "{\"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:
|
members:
|
||||||
- CircuitFunction:
|
- CircuitFunction:
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}":
|
x:
|
||||||
annotations:
|
annotations:
|
||||||
- span:
|
- span:
|
||||||
line_start: 3
|
line_start: 3
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}":
|
x:
|
||||||
annotations:
|
annotations:
|
||||||
- span:
|
- span:
|
||||||
line_start: 3
|
line_start: 3
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}":
|
x:
|
||||||
annotations:
|
annotations:
|
||||||
- span:
|
- span:
|
||||||
line_start: 3
|
line_start: 3
|
||||||
|
@ -4,76 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}":
|
x:
|
||||||
annotations: []
|
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}"
|
|
||||||
input:
|
|
||||||
- Variable:
|
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}"
|
|
||||||
const_: false
|
|
||||||
mutable: true
|
|
||||||
type_:
|
|
||||||
IntegerType: U32
|
|
||||||
span:
|
|
||||||
line_start: 3
|
|
||||||
line_stop: 3
|
|
||||||
col_start: 12
|
|
||||||
col_stop: 13
|
|
||||||
path: ""
|
|
||||||
content: "function x(x: u32, const y: i32) {"
|
|
||||||
- Variable:
|
|
||||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}"
|
|
||||||
const_: true
|
|
||||||
mutable: false
|
|
||||||
type_:
|
|
||||||
IntegerType: I32
|
|
||||||
span:
|
|
||||||
line_start: 3
|
|
||||||
line_stop: 3
|
|
||||||
col_start: 26
|
|
||||||
col_stop: 27
|
|
||||||
path: ""
|
|
||||||
content: "function x(x: u32, const y: i32) {"
|
|
||||||
output: ~
|
|
||||||
block:
|
|
||||||
statements:
|
|
||||||
- Return:
|
|
||||||
expression:
|
|
||||||
TupleInit:
|
|
||||||
elements: []
|
|
||||||
span:
|
|
||||||
line_start: 4
|
|
||||||
line_stop: 4
|
|
||||||
col_start: 12
|
|
||||||
col_stop: 14
|
|
||||||
path: ""
|
|
||||||
content: " return ();"
|
|
||||||
span:
|
|
||||||
line_start: 4
|
|
||||||
line_stop: 4
|
|
||||||
col_start: 5
|
|
||||||
col_stop: 14
|
|
||||||
path: ""
|
|
||||||
content: " return ();"
|
|
||||||
span:
|
|
||||||
line_start: 3
|
|
||||||
line_stop: 5
|
|
||||||
col_start: 34
|
|
||||||
col_stop: 2
|
|
||||||
path: ""
|
|
||||||
content: "function x(x: u32, const y: i32) {\n ...\n}"
|
|
||||||
span:
|
|
||||||
line_start: 3
|
|
||||||
line_stop: 5
|
|
||||||
col_start: 1
|
|
||||||
col_stop: 2
|
|
||||||
path: ""
|
|
||||||
content: "function x(x: u32, const y: i32) {\n ...\n}"
|
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}":
|
|
||||||
annotations: []
|
annotations: []
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}"
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}"
|
||||||
input:
|
input:
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}":
|
x:
|
||||||
annotations: []
|
annotations: []
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}"
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}"
|
||||||
input:
|
input:
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}":
|
x:
|
||||||
annotations: []
|
annotations: []
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}"
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}"
|
||||||
input: []
|
input: []
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}":
|
x:
|
||||||
annotations: []
|
annotations: []
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}"
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}"
|
||||||
input: []
|
input: []
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}":
|
x:
|
||||||
annotations: []
|
annotations: []
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}"
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}"
|
||||||
input:
|
input:
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}":
|
x:
|
||||||
annotations: []
|
annotations: []
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}"
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}"
|
||||||
input:
|
input:
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}":
|
x:
|
||||||
annotations: []
|
annotations: []
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}"
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}"
|
||||||
input:
|
input:
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}":
|
x:
|
||||||
annotations: []
|
annotations: []
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}"
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}"
|
||||||
input:
|
input:
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}":
|
x:
|
||||||
annotations: []
|
annotations: []
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}"
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}"
|
||||||
input:
|
input:
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}":
|
x:
|
||||||
annotations: []
|
annotations: []
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}"
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}"
|
||||||
input: []
|
input: []
|
||||||
|
@ -4,11 +4,12 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports: []
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions:
|
functions:
|
||||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}":
|
x:
|
||||||
annotations: []
|
annotations: []
|
||||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}"
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}"
|
||||||
input: []
|
input: []
|
||||||
|
@ -4,7 +4,7 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports:
|
import_statements:
|
||||||
- package_or_packages:
|
- package_or_packages:
|
||||||
Package:
|
Package:
|
||||||
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import a.b as bar;\\\"}\"}"
|
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import a.b as bar;\\\"}\"}"
|
||||||
@ -33,6 +33,7 @@ outputs:
|
|||||||
col_stop: 18
|
col_stop: 18
|
||||||
path: ""
|
path: ""
|
||||||
content: import a.b as bar;
|
content: import a.b as bar;
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions: {}
|
functions: {}
|
||||||
|
@ -4,7 +4,7 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports:
|
import_statements:
|
||||||
- package_or_packages:
|
- package_or_packages:
|
||||||
Package:
|
Package:
|
||||||
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import a.b;\\\"}\"}"
|
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import a.b;\\\"}\"}"
|
||||||
@ -33,6 +33,7 @@ outputs:
|
|||||||
col_stop: 11
|
col_stop: 11
|
||||||
path: ""
|
path: ""
|
||||||
content: import a.b;
|
content: import a.b;
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions: {}
|
functions: {}
|
||||||
|
@ -4,7 +4,7 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports:
|
import_statements:
|
||||||
- package_or_packages:
|
- package_or_packages:
|
||||||
Packages:
|
Packages:
|
||||||
name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import test-import.( // local import\\\"}\"}"
|
name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import test-import.( // local import\\\"}\"}"
|
||||||
@ -131,6 +131,7 @@ outputs:
|
|||||||
col_stop: 16
|
col_stop: 16
|
||||||
path: ""
|
path: ""
|
||||||
content: "import bar.( // imports directory import\n ...\n ...\n bat.bat.Bat,"
|
content: "import bar.( // imports directory import\n ...\n ...\n bat.bat.Bat,"
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions: {}
|
functions: {}
|
||||||
|
@ -4,7 +4,7 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports:
|
import_statements:
|
||||||
- package_or_packages:
|
- package_or_packages:
|
||||||
Package:
|
Package:
|
||||||
name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import test-import.*; // local import\\\"}\"}"
|
name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import test-import.*; // local import\\\"}\"}"
|
||||||
@ -165,6 +165,7 @@ outputs:
|
|||||||
col_stop: 13
|
col_stop: 13
|
||||||
path: ""
|
path: ""
|
||||||
content: import car.*; // imports directory import
|
content: import car.*; // imports directory import
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions: {}
|
functions: {}
|
||||||
|
@ -4,7 +4,7 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports:
|
import_statements:
|
||||||
- package_or_packages:
|
- package_or_packages:
|
||||||
Package:
|
Package:
|
||||||
name: "{\"name\":\"a0-f\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import a0-f.foo;\\\"}\"}"
|
name: "{\"name\":\"a0-f\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import a0-f.foo;\\\"}\"}"
|
||||||
@ -89,6 +89,7 @@ outputs:
|
|||||||
col_stop: 25
|
col_stop: 25
|
||||||
path: ""
|
path: ""
|
||||||
content: import hello-world.hello;
|
content: import hello-world.hello;
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions: {}
|
functions: {}
|
||||||
|
@ -4,7 +4,7 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports:
|
import_statements:
|
||||||
- package_or_packages:
|
- package_or_packages:
|
||||||
Package:
|
Package:
|
||||||
name: "{\"name\":\"hello_world\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import hello_world.foo;\\\"}\"}"
|
name: "{\"name\":\"hello_world\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import hello_world.foo;\\\"}\"}"
|
||||||
@ -33,6 +33,7 @@ outputs:
|
|||||||
col_stop: 23
|
col_stop: 23
|
||||||
path: ""
|
path: ""
|
||||||
content: import hello_world.foo;
|
content: import hello_world.foo;
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions: {}
|
functions: {}
|
||||||
|
@ -4,7 +4,7 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- name: ""
|
- name: ""
|
||||||
expected_input: []
|
expected_input: []
|
||||||
imports:
|
import_statements:
|
||||||
- package_or_packages:
|
- package_or_packages:
|
||||||
Package:
|
Package:
|
||||||
name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import test-import.*;\\\"}\"}"
|
name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import test-import.*;\\\"}\"}"
|
||||||
@ -31,6 +31,7 @@ outputs:
|
|||||||
col_stop: 21
|
col_stop: 21
|
||||||
path: ""
|
path: ""
|
||||||
content: import test-import.*;
|
content: import test-import.*;
|
||||||
|
imports: {}
|
||||||
circuits: {}
|
circuits: {}
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions: {}
|
functions: {}
|
||||||
|
Loading…
Reference in New Issue
Block a user