mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-27 11:34:44 +03:00
Merge branch 'master' of github.com:AleoHQ/leo into login_command
This commit is contained in:
commit
b2c40649f6
22
Cargo.lock
generated
22
Cargo.lock
generated
@ -1284,7 +1284,7 @@ checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "snarkos-algorithms"
|
name = "snarkos-algorithms"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#c1bab103254631c892fade02662eaa66cc145d58"
|
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#90d41a91b6a431a6cf506a395247e22a3e98b488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blake2",
|
"blake2",
|
||||||
"derivative",
|
"derivative",
|
||||||
@ -1304,7 +1304,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "snarkos-curves"
|
name = "snarkos-curves"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#c1bab103254631c892fade02662eaa66cc145d58"
|
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#90d41a91b6a431a6cf506a395247e22a3e98b488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"derivative",
|
"derivative",
|
||||||
"rand",
|
"rand",
|
||||||
@ -1319,7 +1319,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "snarkos-derives"
|
name = "snarkos-derives"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#c1bab103254631c892fade02662eaa66cc145d58"
|
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#90d41a91b6a431a6cf506a395247e22a3e98b488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.19",
|
"proc-macro2 1.0.19",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
@ -1329,7 +1329,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "snarkos-dpc"
|
name = "snarkos-dpc"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#c1bab103254631c892fade02662eaa66cc145d58"
|
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#90d41a91b6a431a6cf506a395247e22a3e98b488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blake2",
|
"blake2",
|
||||||
"derivative",
|
"derivative",
|
||||||
@ -1350,7 +1350,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "snarkos-errors"
|
name = "snarkos-errors"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#c1bab103254631c892fade02662eaa66cc145d58"
|
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#90d41a91b6a431a6cf506a395247e22a3e98b488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base58",
|
"base58",
|
||||||
"bech32",
|
"bech32",
|
||||||
@ -1363,7 +1363,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "snarkos-gadgets"
|
name = "snarkos-gadgets"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#c1bab103254631c892fade02662eaa66cc145d58"
|
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#90d41a91b6a431a6cf506a395247e22a3e98b488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"derivative",
|
"derivative",
|
||||||
"digest 0.8.1",
|
"digest 0.8.1",
|
||||||
@ -1378,7 +1378,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "snarkos-models"
|
name = "snarkos-models"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#c1bab103254631c892fade02662eaa66cc145d58"
|
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#90d41a91b6a431a6cf506a395247e22a3e98b488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"derivative",
|
"derivative",
|
||||||
@ -1394,7 +1394,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "snarkos-objects"
|
name = "snarkos-objects"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#c1bab103254631c892fade02662eaa66cc145d58"
|
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#90d41a91b6a431a6cf506a395247e22a3e98b488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base58",
|
"base58",
|
||||||
"bech32",
|
"bech32",
|
||||||
@ -1415,7 +1415,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "snarkos-parameters"
|
name = "snarkos-parameters"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#c1bab103254631c892fade02662eaa66cc145d58"
|
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#90d41a91b6a431a6cf506a395247e22a3e98b488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hex",
|
"hex",
|
||||||
"snarkos-algorithms",
|
"snarkos-algorithms",
|
||||||
@ -1427,12 +1427,12 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "snarkos-profiler"
|
name = "snarkos-profiler"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#c1bab103254631c892fade02662eaa66cc145d58"
|
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#90d41a91b6a431a6cf506a395247e22a3e98b488"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "snarkos-utilities"
|
name = "snarkos-utilities"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#c1bab103254631c892fade02662eaa66cc145d58"
|
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#90d41a91b6a431a6cf506a395247e22a3e98b488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"rand",
|
"rand",
|
||||||
|
@ -15,6 +15,7 @@ impl From<Error<Rule>> for SyntaxError {
|
|||||||
Rule::type_integer => "`u32`".to_owned(),
|
Rule::type_integer => "`u32`".to_owned(),
|
||||||
Rule::type_field => "`field`".to_owned(),
|
Rule::type_field => "`field`".to_owned(),
|
||||||
Rule::type_group => "`group`".to_owned(),
|
Rule::type_group => "`group`".to_owned(),
|
||||||
|
Rule::address => "an aleo address: `aleo1...`".to_owned(),
|
||||||
Rule::file => "an import, circuit, or function".to_owned(),
|
Rule::file => "an import, circuit, or function".to_owned(),
|
||||||
Rule::identifier => "a variable name".to_owned(),
|
Rule::identifier => "a variable name".to_owned(),
|
||||||
Rule::type_ => "a type".to_owned(),
|
Rule::type_ => "a type".to_owned(),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{ast::Rule, common::SpreadOrExpression, values::Value, SpanDef};
|
use crate::{ast::Rule, common::SpreadOrExpression, values::PositiveNumber, SpanDef};
|
||||||
|
|
||||||
use pest::Span;
|
use pest::Span;
|
||||||
use pest_ast::FromPest;
|
use pest_ast::FromPest;
|
||||||
@ -8,7 +8,7 @@ use serde::Serialize;
|
|||||||
#[pest_ast(rule(Rule::expression_array_initializer))]
|
#[pest_ast(rule(Rule::expression_array_initializer))]
|
||||||
pub struct ArrayInitializerExpression<'ast> {
|
pub struct ArrayInitializerExpression<'ast> {
|
||||||
pub expression: Box<SpreadOrExpression<'ast>>,
|
pub expression: Box<SpreadOrExpression<'ast>>,
|
||||||
pub count: Value<'ast>,
|
pub count: PositiveNumber<'ast>,
|
||||||
#[pest_ast(outer())]
|
#[pest_ast(outer())]
|
||||||
#[serde(with = "SpanDef")]
|
#[serde(with = "SpanDef")]
|
||||||
pub span: Span<'ast>,
|
pub span: Span<'ast>,
|
||||||
|
@ -169,7 +169,7 @@ type_self = { "Self" }
|
|||||||
type_circuit = { identifier }
|
type_circuit = { identifier }
|
||||||
|
|
||||||
// Declared in types/array_type.rs
|
// Declared in types/array_type.rs
|
||||||
type_array = { type_data ~ ("[" ~ value ~ "]")+ }
|
type_array = { type_data ~ ("[" ~ positive_number ~ "]")+ }
|
||||||
|
|
||||||
type_list = _{ (type_ ~ ("," ~ type_)*)? }
|
type_list = _{ (type_ ~ ("," ~ type_)*)? }
|
||||||
|
|
||||||
@ -188,6 +188,9 @@ value = {
|
|||||||
// Declared in values/number_value.rs
|
// Declared in values/number_value.rs
|
||||||
value_number = @{ (("-" ~ ASCII_NONZERO_DIGIT) | "0" | ASCII_NONZERO_DIGIT) ~ ASCII_DIGIT* }
|
value_number = @{ (("-" ~ ASCII_NONZERO_DIGIT) | "0" | ASCII_NONZERO_DIGIT) ~ ASCII_DIGIT* }
|
||||||
|
|
||||||
|
// Declared in values/number_positive.rs
|
||||||
|
positive_number = @{ ("0" | ASCII_NONZERO_DIGIT) ~ ASCII_DIGIT*}
|
||||||
|
|
||||||
// Declared in values/number_implicit_value.rs
|
// Declared in values/number_implicit_value.rs
|
||||||
value_implicit = { value_number }
|
value_implicit = { value_number }
|
||||||
|
|
||||||
@ -206,7 +209,7 @@ group_tuple = {"(" ~ value_number ~ "," ~ value_number ~ ")"}
|
|||||||
group_single_or_tuple = {value_number | group_tuple}
|
group_single_or_tuple = {value_number | group_tuple}
|
||||||
|
|
||||||
// Declared in values/address.rs
|
// Declared in values/address.rs
|
||||||
address = @{ (LOWERCASE_LETTER | ASCII_DIGIT)* }
|
address = @{ "aleo" ~ ASCII_DIGIT ~ (LOWERCASE_LETTER | ASCII_DIGIT){58} }
|
||||||
|
|
||||||
// Declared in values/address_value.rs
|
// Declared in values/address_value.rs
|
||||||
value_address = { type_address ~ "(" ~ address ~ ")" }
|
value_address = { type_address ~ "(" ~ address ~ ")" }
|
||||||
@ -271,7 +274,7 @@ expression_tuple = _{ (expression ~ ("," ~ expression)*)? }
|
|||||||
expression = { expression_term ~ (operation_binary ~ expression_term)* }
|
expression = { expression_term ~ (operation_binary ~ expression_term)* }
|
||||||
|
|
||||||
// Declared in expressions/array_initializer_expression.rs
|
// Declared in expressions/array_initializer_expression.rs
|
||||||
expression_array_initializer = { "[" ~ spread_or_expression ~ ";" ~ value ~ "]" }
|
expression_array_initializer = { "[" ~ spread_or_expression ~ ";" ~ positive_number ~ "]" }
|
||||||
|
|
||||||
// Declared in expressions/array_inline_expression.rs
|
// Declared in expressions/array_inline_expression.rs
|
||||||
expression_array_inline = { "[" ~ NEWLINE* ~ inline_array_inner ~ NEWLINE* ~ "]"}
|
expression_array_inline = { "[" ~ NEWLINE* ~ inline_array_inner ~ NEWLINE* ~ "]"}
|
||||||
@ -294,12 +297,11 @@ statement = {
|
|||||||
(statement_return
|
(statement_return
|
||||||
| statement_conditional
|
| statement_conditional
|
||||||
| statement_for
|
| statement_for
|
||||||
| (statement_multiple_assignment
|
| statement_multiple_assignment
|
||||||
| statement_macro
|
| statement_macro
|
||||||
| statement_definition
|
| statement_definition
|
||||||
| statement_assign
|
| statement_assign
|
||||||
| statement_expression
|
| statement_expression
|
||||||
)
|
|
||||||
) ~ NEWLINE*
|
) ~ NEWLINE*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{ast::Rule, types::DataType, values::Value, SpanDef};
|
use crate::{ast::Rule, types::DataType, values::PositiveNumber, SpanDef};
|
||||||
|
|
||||||
use pest::Span;
|
use pest::Span;
|
||||||
use pest_ast::FromPest;
|
use pest_ast::FromPest;
|
||||||
@ -8,7 +8,7 @@ use serde::Serialize;
|
|||||||
#[pest_ast(rule(Rule::type_array))]
|
#[pest_ast(rule(Rule::type_array))]
|
||||||
pub struct ArrayType<'ast> {
|
pub struct ArrayType<'ast> {
|
||||||
pub _type: DataType,
|
pub _type: DataType,
|
||||||
pub dimensions: Vec<Value<'ast>>,
|
pub dimensions: Vec<PositiveNumber<'ast>>,
|
||||||
#[pest_ast(outer())]
|
#[pest_ast(outer())]
|
||||||
#[serde(with = "SpanDef")]
|
#[serde(with = "SpanDef")]
|
||||||
pub span: Span<'ast>,
|
pub span: Span<'ast>,
|
||||||
|
@ -22,5 +22,8 @@ pub use number_implicit_value::*;
|
|||||||
pub mod number_value;
|
pub mod number_value;
|
||||||
pub use number_value::*;
|
pub use number_value::*;
|
||||||
|
|
||||||
|
pub mod positive_number;
|
||||||
|
pub use positive_number::*;
|
||||||
|
|
||||||
pub mod value;
|
pub mod value;
|
||||||
pub use value::*;
|
pub use value::*;
|
||||||
|
25
ast/src/values/positive_number.rs
Normal file
25
ast/src/values/positive_number.rs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
use crate::{
|
||||||
|
ast::{span_into_string, Rule},
|
||||||
|
span::SpanDef,
|
||||||
|
};
|
||||||
|
|
||||||
|
use pest::Span;
|
||||||
|
use pest_ast::FromPest;
|
||||||
|
use serde::Serialize;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
|
||||||
|
#[pest_ast(rule(Rule::positive_number))]
|
||||||
|
pub struct PositiveNumber<'ast> {
|
||||||
|
#[pest_ast(outer(with(span_into_string)))]
|
||||||
|
pub value: String,
|
||||||
|
#[pest_ast(outer())]
|
||||||
|
#[serde(with = "SpanDef")]
|
||||||
|
pub span: Span<'ast>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'ast> fmt::Display for PositiveNumber<'ast> {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "{}", self.value)
|
||||||
|
}
|
||||||
|
}
|
3
compiler/tests/address/empty.leo
Normal file
3
compiler/tests/address/empty.leo
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
function main() {
|
||||||
|
let owner = address();
|
||||||
|
}
|
3
compiler/tests/address/invalid_length.leo
Normal file
3
compiler/tests/address/invalid_length.leo
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
function main() {
|
||||||
|
let public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j88);
|
||||||
|
}
|
@ -13,11 +13,27 @@ fn test_valid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_invalid() {
|
fn test_invalid_prefix() {
|
||||||
let bytes = include_bytes!("invalid.leo");
|
let bytes = include_bytes!("invalid_prefix.leo");
|
||||||
let program = parse_program(bytes).unwrap();
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
let _output = expect_compiler_error(program);
|
assert!(syntax_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_invalid_length() {
|
||||||
|
let bytes = include_bytes!("invalid_length.leo");
|
||||||
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
|
assert!(syntax_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_empty() {
|
||||||
|
let bytes = include_bytes!("empty.leo");
|
||||||
|
let syntax_error = parse_program(bytes).is_err();
|
||||||
|
|
||||||
|
assert!(syntax_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
3
compiler/tests/array/initializer_fail.leo
Normal file
3
compiler/tests/array/initializer_fail.leo
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
function main(a: u8[3]) {
|
||||||
|
assert_eq!(a, [1u8; -3]);
|
||||||
|
}
|
@ -42,6 +42,14 @@ fn test_registers() {
|
|||||||
|
|
||||||
// Expressions
|
// Expressions
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_type_fail() {
|
||||||
|
let program_bytes = include_bytes!("type_fail.leo");
|
||||||
|
let syntax_error = parse_program(program_bytes).is_err();
|
||||||
|
|
||||||
|
assert!(syntax_error);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_inline() {
|
fn test_inline() {
|
||||||
let program_bytes = include_bytes!("inline.leo");
|
let program_bytes = include_bytes!("inline.leo");
|
||||||
@ -68,6 +76,15 @@ fn test_initializer() {
|
|||||||
assert_satisfied(program);
|
assert_satisfied(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_initializer_fail() {
|
||||||
|
let program_bytes = include_bytes!("initializer_fail.leo");
|
||||||
|
let input_bytes = include_bytes!("input/three_ones.in");
|
||||||
|
let syntax_error = parse_program_with_input(program_bytes, input_bytes).is_err();
|
||||||
|
|
||||||
|
assert!(syntax_error);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_spread() {
|
fn test_spread() {
|
||||||
let program_bytes = include_bytes!("spread.leo");
|
let program_bytes = include_bytes!("spread.leo");
|
||||||
|
3
compiler/tests/array/type_fail.leo
Normal file
3
compiler/tests/array/type_fail.leo
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
let main() {
|
||||||
|
let a: u32[-2] = [0u32; 2];
|
||||||
|
}
|
@ -13,11 +13,19 @@ use leo_ast::{
|
|||||||
TernaryExpression,
|
TernaryExpression,
|
||||||
},
|
},
|
||||||
operations::BinaryOperation,
|
operations::BinaryOperation,
|
||||||
values::{BooleanValue, FieldValue, GroupValue, IntegerValue, NumberImplicitValue, Value},
|
values::{
|
||||||
|
AddressValue,
|
||||||
|
BooleanValue,
|
||||||
|
FieldValue,
|
||||||
|
GroupValue,
|
||||||
|
IntegerValue,
|
||||||
|
NumberImplicitValue,
|
||||||
|
PositiveNumber as LeoPositiveNumber,
|
||||||
|
Value,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use leo_ast::values::AddressValue;
|
|
||||||
use leo_input::values::NumberValue;
|
use leo_input::values::NumberValue;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
@ -104,21 +112,16 @@ impl Expression {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'ast> Expression {
|
impl<'ast> Expression {
|
||||||
pub(crate) fn get_count_from_value(count: Value<'ast>) -> usize {
|
|
||||||
match count {
|
|
||||||
Value::Integer(integer) => integer
|
|
||||||
.number
|
|
||||||
.value
|
|
||||||
.parse::<usize>()
|
|
||||||
.expect("Unable to read array size"),
|
|
||||||
Value::Implicit(number) => number.number.value.parse::<usize>().expect("Unable to read array size"),
|
|
||||||
size => unimplemented!("Array size should be an integer {}", size),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn get_count_from_number(number: NumberValue<'ast>) -> usize {
|
pub(crate) fn get_count_from_number(number: NumberValue<'ast>) -> usize {
|
||||||
number.value.parse::<usize>().expect("Unable to read array size")
|
number.value.parse::<usize>().expect("Unable to read array size")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn get_count_from_positive_number(number: LeoPositiveNumber<'ast>) -> usize {
|
||||||
|
number
|
||||||
|
.value
|
||||||
|
.parse::<usize>()
|
||||||
|
.expect("Array size should be a positive number")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ast> fmt::Display for Expression {
|
impl<'ast> fmt::Display for Expression {
|
||||||
@ -403,7 +406,7 @@ impl<'ast> From<ArrayInlineExpression<'ast>> for Expression {
|
|||||||
|
|
||||||
impl<'ast> From<ArrayInitializerExpression<'ast>> for Expression {
|
impl<'ast> From<ArrayInitializerExpression<'ast>> for Expression {
|
||||||
fn from(array: ArrayInitializerExpression<'ast>) -> Self {
|
fn from(array: ArrayInitializerExpression<'ast>) -> Self {
|
||||||
let count = Expression::get_count_from_value(array.count);
|
let count = Expression::get_count_from_positive_number(array.count);
|
||||||
let expression = Box::new(SpreadOrExpression::from(*array.expression));
|
let expression = Box::new(SpreadOrExpression::from(*array.expression));
|
||||||
|
|
||||||
Expression::Array(vec![expression; count], Span::from(array.span))
|
Expression::Array(vec![expression; count], Span::from(array.span))
|
||||||
|
@ -101,7 +101,7 @@ impl<'ast> From<ArrayType<'ast>> for Type {
|
|||||||
let dimensions = array_type
|
let dimensions = array_type
|
||||||
.dimensions
|
.dimensions
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|row| Expression::get_count_from_value(row))
|
.map(|row| Expression::get_count_from_positive_number(row))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Type::Array(element_type, dimensions)
|
Type::Array(element_type, dimensions)
|
||||||
|
Loading…
Reference in New Issue
Block a user