mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-24 07:48:04 +03:00
Merge branch 'feat/codegen-for-function-calls' of github.com:AleoHQ/leo into feat/codegen-for-function-calls
This commit is contained in:
commit
c2b53f6d55
@ -33,7 +33,7 @@ Contains the Circuit's name, as well as its members.
|
||||
The members are a function, or a variable, or a constant.
|
||||
For all of them the Circuit preserves their names.
|
||||
|
||||
#### [Decorators](./src/functions/annotation.rs)
|
||||
#### [Annotations](./src/functions/annotation.rs)
|
||||
|
||||
An annotation node is a decorator that can be applied to a function.
|
||||
Stored on the function themselves despite being a top-level node.
|
||||
|
@ -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