-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sol-0.8): add support for export of function at root level
- Loading branch information
Showing
9 changed files
with
130 additions
and
4 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
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
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
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
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
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,19 @@ | ||
pragma solidity >=0.7.1 <0.9.0; | ||
|
||
|
||
// SPDX-License-Identifier: GPL-3.0 | ||
function sum(uint[] memory _arr) pure returns (uint s) { | ||
for (uint i = 0; i < _arr.length; i++) | ||
s += _arr[i]; | ||
} | ||
|
||
contract ArrayExample { | ||
bool found; | ||
function f(uint[] memory _arr) public { | ||
// This calls the free function internally. | ||
// The compiler will add its code to the contract. | ||
uint s = sum(_arr); | ||
require(s >= 10); | ||
found = true; | ||
} | ||
} |
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,18 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity >=0.7.1 <0.9.0; | ||
|
||
function sum(uint[] memory _arr) pure returns (uint s) { | ||
for (uint i = 0; i < _arr.length; i++) | ||
s += _arr[i]; | ||
} | ||
|
||
contract ArrayExample { | ||
bool found; | ||
function f(uint[] memory _arr) public { | ||
// This calls the free function internally. | ||
// The compiler will add its code to the contract. | ||
uint s = sum(_arr); | ||
require(s >= 10); | ||
found = true; | ||
} | ||
} |
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
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