Skip to content

Commit 46da878

Browse files
Merge pull request #1 from ecp-eth/feat/struct-links
feat: struct/enum links and support for natspec
2 parents f8e019d + 54ddce1 commit 46da878

File tree

52 files changed

+837
-753
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+837
-753
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules
44
/dist
55
/fixtures/*/output
66
/coverage
7+
*temp.json

ava.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ export default {
22
ignoredByWatcher: [
33
'**/*.{ts,map,tsbuildinfo}',
44
'fixtures/*/output',
5+
'sitemap-fixtures/*/output',
6+
'source-fixtures/*/output',
57
],
68
typescript: {
79
rewritePaths: { 'src/': 'dist/' },

fixtures/custom/templates/arg.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{#if name}}{{type}} {{name}}{{else}}{{type}}{{/if}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{#if name}}{{type}} {{name}}{{else}}{{type}}{{/if}}

fixtures/helpers/templates/arg.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{#if name}}{{type}} {{name}}{{else}}{{type}}{{/if}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{#if name}}{{type}} {{name}}{{else}}{{type}}{{/if}}

fixtures/solc-0.8/input/Bar.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pragma solidity ^0.8;
2+
3+
struct TestStruct {
4+
uint256 x;
5+
}
6+
7+
enum TestEnum {
8+
A,
9+
B
10+
}

fixtures/solc-0.8/input/Foo.sol

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
pragma solidity ^0.8;
22

3-
contract Bar {
4-
}
3+
import {TestStruct as BarTestStruct, TestEnum as BarTestEnum} from "./Bar.sol";
4+
5+
contract Bar {}
56

67
/**
78
* @dev some devdoc
@@ -10,28 +11,5 @@ contract Foo is Bar {
1011
/**
1112
* @dev and a function
1213
*/
13-
function foo() external {
14-
}
15-
}
16-
17-
/**
18-
* Some Unicode characters: ⇌ £ ह 𐍈 ⇌ £ ह 𐍈
19-
*/
20-
contract X {
21-
/**
22-
* A function
23-
*/
24-
function foo() external {}
25-
26-
/**
27-
* @notice this is a struct
28-
* @param a is a uint256
29-
* @param b is a address
30-
* @param c is a string
31-
*/
32-
struct TheStruct {
33-
uint256 a;
34-
address b;
35-
string c;
36-
}
14+
function foo(BarTestStruct calldata a, BarTestEnum b) external {}
3715
}
Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.6;
3+
pragma solidity ^0.8;
44

55
contract StructAndEnum {
6-
/// @dev This is foo
7-
enum Foo {
8-
FOO,
9-
BAR
10-
}
6+
/// @dev This is foo dev
7+
/// @notice This is foo notice
8+
enum Foo {
9+
/// @dev This is foo dev
10+
/// @notice This is foo notice
11+
FOO,
12+
/// @dev This is bar dev
13+
/// @notice This is bar notice
14+
BAR
15+
}
1116

12-
/// @dev This is bar
13-
struct Bar {
14-
uint256 foo;
15-
string bar;
16-
}
17+
/// Test
18+
/// @notice This is baz notice
19+
/// @dev This is bar dev
20+
struct Bar {
21+
/// @dev This is foo
22+
/// @notice This is foo notice
23+
uint256 foo;
24+
/// @dev This is bar dev
25+
/// @notice This is bar notice
26+
string bar;
27+
}
1728
}

fixtures/struct-enum/solc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
solc-0-8

0 commit comments

Comments
 (0)