mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-18 23:02:35 +03:00
change tests
This commit is contained in:
parent
16914e3ce8
commit
a675b81c0a
@ -65,9 +65,9 @@ impl ParserContext<'_> {
|
||||
/// Returns a [`FunctionInput`] AST node if the next tokens represent a function parameter.
|
||||
///
|
||||
pub fn parse_function_parameters(&mut self) -> Result<FunctionInput> {
|
||||
let public = self.eat(Token::Public).is_some();
|
||||
let const_ = self.eat(Token::Const);
|
||||
let mutable = self.eat(Token::Mut);
|
||||
let public = self.eat(Token::Public).is_some();
|
||||
|
||||
let name = self.expect_ident()?;
|
||||
|
||||
|
@ -67,8 +67,8 @@ impl ParserContext<'_> {
|
||||
/// `<identifier> : <type> = <expression>;`
|
||||
/// Returns [`Definition`].
|
||||
pub fn parse_input_definition(&mut self) -> Result<Definition> {
|
||||
let const_ = self.eat(Token::Const).is_some();
|
||||
let public = self.eat(Token::Public).is_some();
|
||||
let const_ = self.eat(Token::Const).is_some();
|
||||
|
||||
let name = self.expect_ident()?;
|
||||
self.expect(Token::Colon)?;
|
||||
|
@ -11,7 +11,6 @@ outputs:
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}"
|
||||
const_: true
|
||||
private: false
|
||||
public: false
|
||||
mutable: false
|
||||
type_:
|
||||
@ -132,7 +131,6 @@ outputs:
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}"
|
||||
const_: false
|
||||
private: false
|
||||
public: false
|
||||
mutable: true
|
||||
type_: Boolean
|
||||
|
@ -11,7 +11,6 @@ outputs:
|
||||
- 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
|
||||
private: false
|
||||
public: false
|
||||
mutable: true
|
||||
type_:
|
||||
@ -26,7 +25,6 @@ outputs:
|
||||
- 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
|
||||
private: false
|
||||
public: false
|
||||
mutable: false
|
||||
type_:
|
||||
@ -82,7 +80,6 @@ outputs:
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}"
|
||||
const_: true
|
||||
private: false
|
||||
public: false
|
||||
mutable: false
|
||||
type_:
|
||||
@ -97,7 +94,6 @@ outputs:
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}"
|
||||
const_: false
|
||||
private: false
|
||||
public: false
|
||||
mutable: true
|
||||
type_:
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370009]: unexpected string: expected 'ident', got 'public'\n --> test:3:26\n |\n 3 | function x(x: u32, const public y: i32) {\n | ^^^^^^"
|
@ -53,7 +53,6 @@ outputs:
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}"
|
||||
const_: false
|
||||
private: false
|
||||
public: false
|
||||
mutable: true
|
||||
type_: Boolean
|
||||
|
@ -11,7 +11,6 @@ outputs:
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}"
|
||||
const_: false
|
||||
private: false
|
||||
public: false
|
||||
mutable: true
|
||||
type_:
|
||||
@ -26,7 +25,6 @@ outputs:
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}"
|
||||
const_: false
|
||||
private: false
|
||||
public: false
|
||||
mutable: true
|
||||
type_:
|
||||
|
@ -11,7 +11,6 @@ outputs:
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}"
|
||||
const_: false
|
||||
private: false
|
||||
public: false
|
||||
mutable: true
|
||||
type_:
|
||||
@ -26,7 +25,6 @@ outputs:
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}"
|
||||
const_: false
|
||||
private: false
|
||||
public: false
|
||||
mutable: true
|
||||
type_:
|
||||
|
@ -0,0 +1,145 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- name: ""
|
||||
expected_input: []
|
||||
functions:
|
||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public const y: i32) {\\\"}\"}":
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public 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, public const y: i32) {\\\"}\"}"
|
||||
const_: false
|
||||
public: 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, public const y: i32) {"
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public const y: i32) {\\\"}\"}"
|
||||
const_: true
|
||||
public: true
|
||||
mutable: false
|
||||
type_:
|
||||
IntegerType: I32
|
||||
span:
|
||||
line_start: 3
|
||||
line_stop: 3
|
||||
col_start: 33
|
||||
col_stop: 34
|
||||
path: ""
|
||||
content: "function x(x: u32, public const y: i32) {"
|
||||
const_: false
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
Value:
|
||||
Implicit:
|
||||
- "0"
|
||||
- span:
|
||||
line_start: 4
|
||||
line_stop: 4
|
||||
col_start: 12
|
||||
col_stop: 13
|
||||
path: ""
|
||||
content: " return 0;"
|
||||
span:
|
||||
line_start: 4
|
||||
line_stop: 4
|
||||
col_start: 5
|
||||
col_stop: 13
|
||||
path: ""
|
||||
content: " return 0;"
|
||||
span:
|
||||
line_start: 3
|
||||
line_stop: 5
|
||||
col_start: 41
|
||||
col_stop: 2
|
||||
path: ""
|
||||
content: "function x(x: u32, public const y: i32) {\n ...\n}"
|
||||
span:
|
||||
line_start: 3
|
||||
line_stop: 5
|
||||
col_start: 1
|
||||
col_stop: 2
|
||||
path: ""
|
||||
content: "function x(x: u32, public const y: i32) {\n ...\n}"
|
||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public 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(public const x: u32, y: i32) {\\\"}\"}"
|
||||
input:
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":25,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public const x: u32, y: i32) {\\\"}\"}"
|
||||
const_: true
|
||||
public: true
|
||||
mutable: false
|
||||
type_:
|
||||
IntegerType: U32
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 7
|
||||
col_start: 25
|
||||
col_stop: 26
|
||||
path: ""
|
||||
content: "function x(public const x: u32, y: i32) {"
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public const x: u32, y: i32) {\\\"}\"}"
|
||||
const_: false
|
||||
public: false
|
||||
mutable: true
|
||||
type_:
|
||||
IntegerType: I32
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 7
|
||||
col_start: 33
|
||||
col_stop: 34
|
||||
path: ""
|
||||
content: "function x(public const x: u32, y: i32) {"
|
||||
const_: false
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
Value:
|
||||
Implicit:
|
||||
- "0"
|
||||
- span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 12
|
||||
col_stop: 13
|
||||
path: ""
|
||||
content: " return 0;"
|
||||
span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 5
|
||||
col_stop: 13
|
||||
path: ""
|
||||
content: " return 0;"
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 9
|
||||
col_start: 41
|
||||
col_stop: 2
|
||||
path: ""
|
||||
content: "function x(public const x: u32, y: i32) {\n ...\n}"
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 9
|
||||
col_start: 1
|
||||
col_stop: 2
|
||||
path: ""
|
||||
content: "function x(public const x: u32, y: i32) {\n ...\n}"
|
145
tests/expectations/parser/parser/functions/public_param.leo.out
Normal file
145
tests/expectations/parser/parser/functions/public_param.leo.out
Normal file
@ -0,0 +1,145 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- name: ""
|
||||
expected_input: []
|
||||
functions:
|
||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public y: i32) {\\\"}\"}":
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public 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, public y: i32) {\\\"}\"}"
|
||||
const_: false
|
||||
public: 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, public y: i32) {"
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":27,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public y: i32) {\\\"}\"}"
|
||||
const_: false
|
||||
public: true
|
||||
mutable: true
|
||||
type_:
|
||||
IntegerType: I32
|
||||
span:
|
||||
line_start: 3
|
||||
line_stop: 3
|
||||
col_start: 27
|
||||
col_stop: 28
|
||||
path: ""
|
||||
content: "function x(x: u32, public y: i32) {"
|
||||
const_: false
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
Value:
|
||||
Implicit:
|
||||
- "0"
|
||||
- span:
|
||||
line_start: 4
|
||||
line_stop: 4
|
||||
col_start: 12
|
||||
col_stop: 13
|
||||
path: ""
|
||||
content: " return 0;"
|
||||
span:
|
||||
line_start: 4
|
||||
line_stop: 4
|
||||
col_start: 5
|
||||
col_stop: 13
|
||||
path: ""
|
||||
content: " return 0;"
|
||||
span:
|
||||
line_start: 3
|
||||
line_stop: 5
|
||||
col_start: 35
|
||||
col_stop: 2
|
||||
path: ""
|
||||
content: "function x(x: u32, public y: i32) {\n ...\n}"
|
||||
span:
|
||||
line_start: 3
|
||||
line_stop: 5
|
||||
col_start: 1
|
||||
col_stop: 2
|
||||
path: ""
|
||||
content: "function x(x: u32, public y: i32) {\n ...\n}"
|
||||
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public x: u32, y: i32) {\\\"}\"}":
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public x: u32, y: i32) {\\\"}\"}"
|
||||
input:
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public x: u32, y: i32) {\\\"}\"}"
|
||||
const_: false
|
||||
public: true
|
||||
mutable: true
|
||||
type_:
|
||||
IntegerType: U32
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 7
|
||||
col_start: 19
|
||||
col_stop: 20
|
||||
path: ""
|
||||
content: "function x(public x: u32, y: i32) {"
|
||||
- Variable:
|
||||
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":27,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public x: u32, y: i32) {\\\"}\"}"
|
||||
const_: false
|
||||
public: false
|
||||
mutable: true
|
||||
type_:
|
||||
IntegerType: I32
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 7
|
||||
col_start: 27
|
||||
col_stop: 28
|
||||
path: ""
|
||||
content: "function x(public x: u32, y: i32) {"
|
||||
const_: false
|
||||
output: ~
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements:
|
||||
- Return:
|
||||
expression:
|
||||
Value:
|
||||
Implicit:
|
||||
- "0"
|
||||
- span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 12
|
||||
col_stop: 13
|
||||
path: ""
|
||||
content: " return 0;"
|
||||
span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 5
|
||||
col_stop: 13
|
||||
path: ""
|
||||
content: " return 0;"
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 9
|
||||
col_start: 35
|
||||
col_stop: 2
|
||||
path: ""
|
||||
content: "function x(public x: u32, y: i32) {\n ...\n}"
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 9
|
||||
col_start: 1
|
||||
col_stop: 2
|
||||
path: ""
|
||||
content: "function x(public x: u32, y: i32) {\n ...\n}"
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Input
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370009]: unexpected string: expected 'ident', got 'public'\n --> test:4:7\n |\n 4 | const public a: bool = true; \n | ^^^^^^"
|
@ -6,7 +6,6 @@ outputs:
|
||||
- name: main
|
||||
definitions:
|
||||
- const_: true
|
||||
private: false
|
||||
public: false
|
||||
type_: Boolean
|
||||
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const a: bool = true; \\\"}\"}"
|
||||
@ -29,7 +28,6 @@ outputs:
|
||||
path: ""
|
||||
content: "const a: bool = true; "
|
||||
- const_: true
|
||||
private: false
|
||||
public: false
|
||||
type_:
|
||||
IntegerType: U8
|
||||
@ -53,7 +51,6 @@ outputs:
|
||||
path: ""
|
||||
content: "const b: u8 = 2; "
|
||||
- const_: true
|
||||
private: false
|
||||
public: false
|
||||
type_: Field
|
||||
name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const c: field = 0; \\\"}\"}"
|
||||
@ -76,7 +73,6 @@ outputs:
|
||||
path: ""
|
||||
content: "const c: field = 0; "
|
||||
- const_: true
|
||||
private: false
|
||||
public: false
|
||||
type_: Group
|
||||
name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const d: group = (0, 1)group; \\\"}\"}"
|
||||
@ -119,7 +115,6 @@ outputs:
|
||||
path: ""
|
||||
content: "const d: group = (0, 1)group; "
|
||||
- const_: true
|
||||
private: false
|
||||
public: false
|
||||
type_: Address
|
||||
name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
|
||||
@ -151,7 +146,6 @@ outputs:
|
||||
- name: registers
|
||||
definitions:
|
||||
- const_: false
|
||||
private: false
|
||||
public: false
|
||||
type_: Boolean
|
||||
name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}"
|
||||
@ -174,7 +168,6 @@ outputs:
|
||||
path: ""
|
||||
content: "r0: bool = true; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: false
|
||||
type_:
|
||||
IntegerType: U8
|
||||
@ -198,7 +191,6 @@ outputs:
|
||||
path: ""
|
||||
content: "r1: u8 = 2; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: false
|
||||
type_: Field
|
||||
name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}"
|
||||
@ -221,7 +213,6 @@ outputs:
|
||||
path: ""
|
||||
content: "r2: field = 0; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: false
|
||||
type_: Group
|
||||
name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}"
|
||||
@ -264,7 +255,6 @@ outputs:
|
||||
path: ""
|
||||
content: "r3: group = (0, 1)group; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: false
|
||||
type_: Address
|
||||
name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
|
||||
|
@ -0,0 +1,285 @@
|
||||
---
|
||||
namespace: Input
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- sections:
|
||||
- name: main
|
||||
definitions:
|
||||
- const_: true
|
||||
public: true
|
||||
type_: Boolean
|
||||
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public const a: bool = true; \\\"}\"}"
|
||||
value:
|
||||
Value:
|
||||
Boolean:
|
||||
- "true"
|
||||
- span:
|
||||
line_start: 4
|
||||
line_stop: 4
|
||||
col_start: 25
|
||||
col_stop: 29
|
||||
path: ""
|
||||
content: "public const a: bool = true; "
|
||||
span:
|
||||
line_start: 4
|
||||
line_stop: 4
|
||||
col_start: 17
|
||||
col_stop: 21
|
||||
path: ""
|
||||
content: "public const a: bool = true; "
|
||||
- const_: true
|
||||
public: true
|
||||
type_:
|
||||
IntegerType: U8
|
||||
name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public const b: u8 = 2; \\\"}\"}"
|
||||
value:
|
||||
Value:
|
||||
Implicit:
|
||||
- "2"
|
||||
- span:
|
||||
line_start: 5
|
||||
line_stop: 5
|
||||
col_start: 25
|
||||
col_stop: 26
|
||||
path: ""
|
||||
content: "public const b: u8 = 2; "
|
||||
span:
|
||||
line_start: 5
|
||||
line_stop: 5
|
||||
col_start: 17
|
||||
col_stop: 19
|
||||
path: ""
|
||||
content: "public const b: u8 = 2; "
|
||||
- const_: true
|
||||
public: true
|
||||
type_: Field
|
||||
name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public const c: field = 0; \\\"}\"}"
|
||||
value:
|
||||
Value:
|
||||
Implicit:
|
||||
- "0"
|
||||
- span:
|
||||
line_start: 6
|
||||
line_stop: 6
|
||||
col_start: 25
|
||||
col_stop: 26
|
||||
path: ""
|
||||
content: "public const c: field = 0; "
|
||||
span:
|
||||
line_start: 6
|
||||
line_stop: 6
|
||||
col_start: 17
|
||||
col_stop: 22
|
||||
path: ""
|
||||
content: "public const c: field = 0; "
|
||||
- const_: true
|
||||
public: true
|
||||
type_: Group
|
||||
name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public const d: group = (0, 1)group; \\\"}\"}"
|
||||
value:
|
||||
Value:
|
||||
Group:
|
||||
Tuple:
|
||||
x:
|
||||
Number:
|
||||
- "0"
|
||||
- span:
|
||||
line_start: 7
|
||||
line_stop: 7
|
||||
col_start: 26
|
||||
col_stop: 27
|
||||
path: ""
|
||||
content: "public const d: group = (0, 1)group; "
|
||||
y:
|
||||
Number:
|
||||
- "1"
|
||||
- span:
|
||||
line_start: 7
|
||||
line_stop: 7
|
||||
col_start: 29
|
||||
col_stop: 30
|
||||
path: ""
|
||||
content: "public const d: group = (0, 1)group; "
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 7
|
||||
col_start: 26
|
||||
col_stop: 36
|
||||
path: ""
|
||||
content: "public const d: group = (0, 1)group; "
|
||||
span:
|
||||
line_start: 7
|
||||
line_stop: 7
|
||||
col_start: 17
|
||||
col_stop: 22
|
||||
path: ""
|
||||
content: "public const d: group = (0, 1)group; "
|
||||
- const_: true
|
||||
public: true
|
||||
type_: Address
|
||||
name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
|
||||
value:
|
||||
Value:
|
||||
Address:
|
||||
- aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8
|
||||
- span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 27
|
||||
col_stop: 90
|
||||
path: ""
|
||||
content: "public const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
|
||||
span:
|
||||
line_start: 8
|
||||
line_stop: 8
|
||||
col_start: 17
|
||||
col_stop: 24
|
||||
path: ""
|
||||
content: "public const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
|
||||
span:
|
||||
line_start: 3
|
||||
line_stop: 3
|
||||
col_start: 2
|
||||
col_stop: 6
|
||||
path: ""
|
||||
content: "[main]"
|
||||
- name: registers
|
||||
definitions:
|
||||
- const_: false
|
||||
public: false
|
||||
type_: Boolean
|
||||
name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}"
|
||||
value:
|
||||
Value:
|
||||
Boolean:
|
||||
- "true"
|
||||
- span:
|
||||
line_start: 11
|
||||
line_stop: 11
|
||||
col_start: 13
|
||||
col_stop: 17
|
||||
path: ""
|
||||
content: "r0: bool = true; "
|
||||
span:
|
||||
line_start: 11
|
||||
line_stop: 11
|
||||
col_start: 5
|
||||
col_stop: 9
|
||||
path: ""
|
||||
content: "r0: bool = true; "
|
||||
- const_: false
|
||||
public: false
|
||||
type_:
|
||||
IntegerType: U8
|
||||
name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}"
|
||||
value:
|
||||
Value:
|
||||
Implicit:
|
||||
- "2"
|
||||
- span:
|
||||
line_start: 12
|
||||
line_stop: 12
|
||||
col_start: 13
|
||||
col_stop: 14
|
||||
path: ""
|
||||
content: "r1: u8 = 2; "
|
||||
span:
|
||||
line_start: 12
|
||||
line_stop: 12
|
||||
col_start: 5
|
||||
col_stop: 7
|
||||
path: ""
|
||||
content: "r1: u8 = 2; "
|
||||
- const_: false
|
||||
public: false
|
||||
type_: Field
|
||||
name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}"
|
||||
value:
|
||||
Value:
|
||||
Implicit:
|
||||
- "0"
|
||||
- span:
|
||||
line_start: 13
|
||||
line_stop: 13
|
||||
col_start: 13
|
||||
col_stop: 14
|
||||
path: ""
|
||||
content: "r2: field = 0; "
|
||||
span:
|
||||
line_start: 13
|
||||
line_stop: 13
|
||||
col_start: 5
|
||||
col_stop: 10
|
||||
path: ""
|
||||
content: "r2: field = 0; "
|
||||
- const_: false
|
||||
public: false
|
||||
type_: Group
|
||||
name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}"
|
||||
value:
|
||||
Value:
|
||||
Group:
|
||||
Tuple:
|
||||
x:
|
||||
Number:
|
||||
- "0"
|
||||
- span:
|
||||
line_start: 14
|
||||
line_stop: 14
|
||||
col_start: 14
|
||||
col_stop: 15
|
||||
path: ""
|
||||
content: "r3: group = (0, 1)group; "
|
||||
y:
|
||||
Number:
|
||||
- "1"
|
||||
- span:
|
||||
line_start: 14
|
||||
line_stop: 14
|
||||
col_start: 17
|
||||
col_stop: 18
|
||||
path: ""
|
||||
content: "r3: group = (0, 1)group; "
|
||||
span:
|
||||
line_start: 14
|
||||
line_stop: 14
|
||||
col_start: 14
|
||||
col_stop: 24
|
||||
path: ""
|
||||
content: "r3: group = (0, 1)group; "
|
||||
span:
|
||||
line_start: 14
|
||||
line_stop: 14
|
||||
col_start: 5
|
||||
col_stop: 10
|
||||
path: ""
|
||||
content: "r3: group = (0, 1)group; "
|
||||
- const_: false
|
||||
public: false
|
||||
type_: Address
|
||||
name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
|
||||
value:
|
||||
Value:
|
||||
Address:
|
||||
- aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8
|
||||
- span:
|
||||
line_start: 15
|
||||
line_stop: 15
|
||||
col_start: 15
|
||||
col_stop: 78
|
||||
path: ""
|
||||
content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
|
||||
span:
|
||||
line_start: 15
|
||||
line_stop: 15
|
||||
col_start: 5
|
||||
col_stop: 12
|
||||
path: ""
|
||||
content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
|
||||
span:
|
||||
line_start: 10
|
||||
line_stop: 10
|
||||
col_start: 2
|
||||
col_stop: 11
|
||||
path: ""
|
||||
content: "[registers]"
|
@ -6,7 +6,6 @@ outputs:
|
||||
- name: main
|
||||
definitions:
|
||||
- const_: false
|
||||
private: false
|
||||
public: true
|
||||
type_: Boolean
|
||||
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public a: bool = true; \\\"}\"}"
|
||||
@ -29,7 +28,6 @@ outputs:
|
||||
path: ""
|
||||
content: "public a: bool = true; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: true
|
||||
type_:
|
||||
IntegerType: U8
|
||||
@ -53,7 +51,6 @@ outputs:
|
||||
path: ""
|
||||
content: "public b: u8 = 2; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: true
|
||||
type_: Field
|
||||
name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public c: field = 0; \\\"}\"}"
|
||||
@ -76,7 +73,6 @@ outputs:
|
||||
path: ""
|
||||
content: "public c: field = 0; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: true
|
||||
type_: Group
|
||||
name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public d: group = (0, 1)group; \\\"}\"}"
|
||||
@ -119,7 +115,6 @@ outputs:
|
||||
path: ""
|
||||
content: "public d: group = (0, 1)group; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: true
|
||||
type_: Address
|
||||
name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
|
||||
@ -151,7 +146,6 @@ outputs:
|
||||
- name: registers
|
||||
definitions:
|
||||
- const_: false
|
||||
private: false
|
||||
public: false
|
||||
type_: Boolean
|
||||
name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}"
|
||||
@ -174,7 +168,6 @@ outputs:
|
||||
path: ""
|
||||
content: "r0: bool = true; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: false
|
||||
type_:
|
||||
IntegerType: U8
|
||||
@ -198,7 +191,6 @@ outputs:
|
||||
path: ""
|
||||
content: "r1: u8 = 2; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: false
|
||||
type_: Field
|
||||
name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}"
|
||||
@ -221,7 +213,6 @@ outputs:
|
||||
path: ""
|
||||
content: "r2: field = 0; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: false
|
||||
type_: Group
|
||||
name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}"
|
||||
@ -264,7 +255,6 @@ outputs:
|
||||
path: ""
|
||||
content: "r3: group = (0, 1)group; "
|
||||
- const_: false
|
||||
private: false
|
||||
public: false
|
||||
type_: Address
|
||||
name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
|
||||
|
12
tests/parser/functions/const_public_param_fail.leo
Normal file
12
tests/parser/functions/const_public_param_fail.leo
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
function x(x: u32, const public y: i32) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function x(const public x: u32, y: i32) {
|
||||
return 0;
|
||||
}
|
12
tests/parser/functions/public_const_param.leo
Normal file
12
tests/parser/functions/public_const_param.leo
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
function x(x: u32, public const y: i32) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function x(public const x: u32, y: i32) {
|
||||
return 0;
|
||||
}
|
12
tests/parser/functions/public_param.leo
Normal file
12
tests/parser/functions/public_param.leo
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
function x(x: u32, public y: i32) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function x(public x: u32, y: i32) {
|
||||
return 0;
|
||||
}
|
19
tests/parser/inputs/input_const_public_fail.leo
Normal file
19
tests/parser/inputs/input_const_public_fail.leo
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
namespace: Input
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
[main]
|
||||
const public a: bool = true;
|
||||
const public b: u8 = 2;
|
||||
const public c: field = 0;
|
||||
const public d: group = (0, 1)group;
|
||||
const public e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
|
||||
[registers]
|
||||
r0: bool = true;
|
||||
r1: u8 = 2;
|
||||
r2: field = 0;
|
||||
r3: group = (0, 1)group;
|
||||
r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
|
@ -4,11 +4,11 @@ expectation: Pass
|
||||
*/
|
||||
|
||||
[main]
|
||||
private a: bool = true;
|
||||
private b: u8 = 2;
|
||||
private c: field = 0;
|
||||
private d: group = (0, 1)group;
|
||||
private e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
public const a: bool = true;
|
||||
public const b: u8 = 2;
|
||||
public const c: field = 0;
|
||||
public const d: group = (0, 1)group;
|
||||
public const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
|
||||
[registers]
|
||||
r0: bool = true;
|
Loading…
Reference in New Issue
Block a user