Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
ink
Commits
d2c6c743
Unverified
Commit
d2c6c743
authored
Mar 22, 2019
by
Robin Freyler
Browse files
[lang] Add feature to control JSON api description generation
parent
930361f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
lang/Cargo.toml
View file @
d2c6c743
...
...
@@ -45,3 +45,4 @@ test-env = [
"pdsl_core/test-env"
,
"pdsl_model/test-env"
,
]
generate-api-description
=
[]
lang/src/lib.rs
View file @
d2c6c743
...
...
@@ -31,7 +31,9 @@ pub fn contract(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
#[macro_use]
mod
errors
;
#[cfg(features
=
"generate-api-description"
)]
mod
api
;
mod
ast
;
mod
gen
;
mod
hir
;
...
...
@@ -61,7 +63,15 @@ pub(crate) fn contract_gen_impl2(
)
->
Result
<
proc_macro2
::
TokenStream
>
{
let
ast_contract
=
parser
::
parse_contract
(
input
.clone
())
?
;
let
hir_contract
=
hir
::
Contract
::
from_ast
(
&
ast_contract
)
?
;
api
::
generate_api_description
(
&
hir_contract
);
generate_api_description
(
&
hir_contract
);
let
tokens
=
gen
::
codegen
(
&
hir_contract
);
Ok
(
tokens
.into
())
}
#[cfg(features
=
"generate-api-description"
)]
fn
generate_api_description
(
contract
:
&
hir
::
Contract
)
{
api
::
generate_api_description
(
&
hir_contract
);
}
#[cfg(not(features
=
"generate-api-description"
))]
fn
generate_api_description
(
_contract
:
&
hir
::
Contract
)
{}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment