diff --git a/Changelog.md b/Changelog.md index aed64a0c0..39e171324 100644 --- a/Changelog.md +++ b/Changelog.md @@ -20,9 +20,6 @@ Compiler Features: Bugfixes: * ABI: Include events in the ABI that are emitted by a contract but defined outside of it. - * Antlr Grammar: Fix discrepancy with the parser, which allowed octal numbers. - * Antlr Grammar: Fix of a discrepancy with the parser, which allowed numbers followed by an identifier with no whitespace. - * Antlr Grammar: Stricter rules for function definitions. The grammar will no longer accept as valid free functions having specifiers which are exclusive to contract functions. * Immutables: Disallow initialization of immutables in try/catch statements. * SMTChecker: Fix false positives in ternary operators that contain verification targets in its branches, directly or indirectly. diff --git a/docs/grammar/SolidityParser.g4 b/docs/grammar/SolidityParser.g4 index ed8651ae7..b8744673d 100644 --- a/docs/grammar/SolidityParser.g4 +++ b/docs/grammar/SolidityParser.g4 @@ -16,7 +16,7 @@ sourceUnit: ( | contractDefinition | interfaceDefinition | libraryDefinition - | freeFunctionDefinition + | functionDefinition | constantVariableDeclaration | structDefinition | enumDefinition @@ -85,7 +85,7 @@ inheritanceSpecifier: name=identifierPath arguments=callArgumentList?; */ contractBodyElement: constructorDefinition - | contractFunctionDefinition + | functionDefinition | modifierDefinition | fallbackFunctionDefinition | receiveFunctionDefinition @@ -152,11 +152,11 @@ stateMutability: Pure | View | Payable; */ overrideSpecifier: Override (LParen overrides+=identifierPath (Comma overrides+=identifierPath)* RParen)?; /** - * The definition of contract, library and interface functions. + * The definition of contract, library, interface or free functions. * Depending on the context in which the function is defined, further restrictions may apply, * e.g. functions in interfaces have to be unimplemented, i.e. may not contain a body block. */ -contractFunctionDefinition +functionDefinition locals[ boolean visibilitySet = false, boolean mutabilitySet = false, @@ -176,16 +176,6 @@ locals[ (Returns LParen returnParameters=parameterList RParen)? (Semicolon | body=block); -/** - * The definition of a free function. - */ - freeFunctionDefinition: - Function (identifier | Fallback | Receive) - LParen (arguments=parameterList)? RParen - stateMutability? - (Returns LParen returnParameters=parameterList RParen)? - (Semicolon | body=block); - /** * The definition of a modifier. * Note that within the body block of a modifier, the underscore cannot be used as identifier,