mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-23 15:15:47 +03:00
Cleanup; add test
This commit is contained in:
parent
d397c750d2
commit
a47eb32eaf
@ -83,10 +83,10 @@ impl<'a> CodeGenerator<'a> {
|
||||
closures.push_str(&function_string);
|
||||
closures.push('\n');
|
||||
}
|
||||
});
|
||||
|
||||
// Unset the `is_program_function` flag.
|
||||
self.is_program_function = false;
|
||||
// Unset the `is_program_function` flag.
|
||||
self.is_program_function = false;
|
||||
});
|
||||
|
||||
// Closures must precede functions in the Aleo program.
|
||||
program_string.push_str(&closures);
|
||||
@ -187,9 +187,6 @@ impl<'a> CodeGenerator<'a> {
|
||||
let block_string = self.visit_block(&function.block);
|
||||
function_string.push_str(&block_string);
|
||||
|
||||
// Unset `is_program_function` after visiting `function`.
|
||||
self.is_program_function = false;
|
||||
|
||||
function_string
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- name: ""
|
||||
network: ""
|
||||
expected_input: []
|
||||
imports: {}
|
||||
functions:
|
||||
"{\"name\":\"test\",\"span\":\"{\\\"lo\\\":94,\\\"hi\\\":98}\"}":
|
||||
annotations:
|
||||
- identifier: "{\"name\":\"test\",\"span\":\"{\\\"lo\\\":79,\\\"hi\\\":83}\"}"
|
||||
span:
|
||||
lo: 78
|
||||
hi: 83
|
||||
identifier: "{\"name\":\"test\",\"span\":\"{\\\"lo\\\":94,\\\"hi\\\":98}\"}"
|
||||
input: []
|
||||
output: U8
|
||||
core_mapping: ~
|
||||
block:
|
||||
statements: []
|
||||
span:
|
||||
lo: 107
|
||||
hi: 109
|
||||
span:
|
||||
lo: 85
|
||||
hi: 109
|
||||
circuits: {}
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370028]: Illegal spacing in the annotation declaration.\n --> test:3:1\n |\n 3 | @ test\n | ^^^^^^\n |\n = Remove whitespace between the `@` symbol and the identifier."
|
7
tests/parser/functions/spaced_annotation_fail.leo
Normal file
7
tests/parser/functions/spaced_annotation_fail.leo
Normal file
@ -0,0 +1,7 @@
|
||||
/*
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
@ test
|
||||
function test() -> u8 {}
|
Loading…
Reference in New Issue
Block a user