Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
ink
Commits
e1486563
Unverified
Commit
e1486563
authored
Jun 09, 2021
by
GreenBaneling | Supercolony
Committed by
GitHub
Jun 09, 2021
Browse files
Not generate metadata if compile_as_dependency is true (#811)
parent
9bda2031
Pipeline
#142764
failed with stages
in 8 minutes and 29 seconds
Changes
1
Pipelines
9
Hide whitespace changes
Inline
Side-by-side
crates/lang/codegen/src/generator/metadata.rs
View file @
e1486563
...
...
@@ -29,14 +29,24 @@ pub struct Metadata<'a> {
contract
:
&
'a
ir
::
Contract
,
}
impl
Metadata
<
'_
>
{
fn
generate_cgf
(
&
self
)
->
TokenStream2
{
if
self
.contract
.config
()
.is_compile_as_dependency_enabled
()
{
return
quote!
{
#[cfg(feature
=
"__ink_DO_NOT_COMPILE"
)]
}
}
quote!
{
#[cfg(not(feature
=
"ink-as-dependency"
))]
}
}
}
impl
GenerateCode
for
Metadata
<
'_
>
{
fn
generate_code
(
&
self
)
->
TokenStream2
{
let
contract
=
self
.generate_contract
();
let
layout
=
self
.generate_layout
();
let
no_cross_calling_cfg
=
self
.generate_cgf
();
quote!
{
#[cfg(feature
=
"std"
)]
#
[cfg(not(feature
=
"ink-as-dependency"
))]
#
no_cross_calling_cfg
const
_
:
()
=
{
#[no_mangle]
pub
fn
__ink_generate_metadata
()
->
::
ink_metadata
::
InkProject
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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