-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docgen should output attributes (#7932). Output attributes (e.g., #[view] or #[resource_group(scope = global)]) from docgen for move code. Currently only handles attibutes on Function, Script/Module, and Struct/Resource. Note that attributes are allowed on some other syntactic objects (address scope, use statement, const definition, spec), but how to format these usefully in docgen is unclear. for these in docgen is unclear. Also fix an unrelated bug discovered when adapting attribute_placement.move as a test of docgen: previously, only a single Module/Script per input file would be output in docgen.
- Loading branch information
1 parent
42e7c40
commit b43abcf
Showing
5 changed files
with
851 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#[attr1] | ||
address 0x42 { | ||
#[attr2] | ||
#[attr7] | ||
module M { | ||
#[attr3] | ||
use 0x42::N; | ||
|
||
#[attr4] | ||
struct S {} | ||
|
||
#[attr4b] | ||
#[resource_group(scope = global)] | ||
struct T {} | ||
|
||
#[attr2] | ||
#[attr5] | ||
const C: u64 = 0; | ||
|
||
#[attr6] | ||
#[resource_group_member(group = std::string::String)] | ||
public fun foo() { N::bar() } | ||
|
||
#[attr7] | ||
spec foo {} | ||
} | ||
} | ||
|
||
#[attr8] | ||
module 0x42::N { | ||
#[attr9] | ||
friend 0x42::M; | ||
|
||
#[attr10] | ||
public fun bar() {} | ||
} | ||
|
||
#[attr11] | ||
script { | ||
#[attr12] | ||
use 0x42::M; | ||
|
||
#[attr13] | ||
const C: u64 = 0; | ||
|
||
#[attr14] | ||
fun main() { | ||
M::foo(); | ||
} | ||
|
||
#[attr15] | ||
spec main { } | ||
} |
Oops, something went wrong.