Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion samples/simple.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import "./abc.sol" as x;
import * as y from "./abc.sol";
import {a as b, c as d, f} from "./abc.sol";

contract SimpleAuction {
contract Parent {
function saySomething(string calldata text) external pure returns (string memory) {
return text;
}
}

contract SimpleAuction is Parent {
// Parameters of the auction. Times are either
// absolute unix timestamps (seconds since 1970-01-01)
// or time periods in seconds.
Expand Down Expand Up @@ -117,6 +123,10 @@ contract SimpleAuction {
return true;
}

function saySomething(string calldata text) external pure override returns (string memory) {
return text;
}

modifier loli () {

}
Expand Down
10 changes: 7 additions & 3 deletions solidity_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _mapCommasToNulls(self, children):
values = []
comma = True

for el in children:
for el in children:
if comma:
if el.getText() == ',':
values.append(None)
Expand Down Expand Up @@ -166,7 +166,7 @@ def visitContractPart(self, ctx: SolidityParser.ContractPartContext):


def visitFunctionDefinition(self, ctx: SolidityParser.FunctionDefinitionContext):
isConstructor = isFallback =isReceive = False
isConstructor = isFallback = isReceive = isOverride = False

fd = ctx.functionDescriptor()
if fd.ConstructorKeyword():
Expand All @@ -181,7 +181,7 @@ def visitFunctionDefinition(self, ctx: SolidityParser.FunctionDefinitionContext)
elif fd.identifier():
name = fd.identifier().getText()
else:
name = ctx.getText()
name = ctx.getText()

parameters = self.visit(ctx.parameterList())
returnParameters = self.visit(ctx.returnParameters()) if ctx.returnParameters() else []
Expand All @@ -204,6 +204,9 @@ def visitFunctionDefinition(self, ctx: SolidityParser.FunctionDefinitionContext)
else:
stateMutability = None

if ctx.modifierList().overrideSpecifier():
isOverride = True

return Node(ctx=ctx,
type="FunctionDefinition",
name=name,
Expand All @@ -215,6 +218,7 @@ def visitFunctionDefinition(self, ctx: SolidityParser.FunctionDefinitionContext)
isConstructor=isConstructor,
isFallback=isFallback,
isReceive=isReceive,
isOverride=isOverride,
stateMutability=stateMutability)

def visitReturnParameters(self, ctx: SolidityParser.ReturnParametersContext):
Expand Down