ConsenSysMesh / solidity-parser

Solidity Parser in Javascript
138 stars 54 forks source link

Parse function return type independently from modifiers #54

Closed federicobond closed 6 years ago

federicobond commented 7 years ago

The following code:

function returns(uint) {}

Generates this AST:

{
  "type": "FunctionDeclaration",
  "name": "b",
  "params": null,
  "modifiers": [
    {
      "type": "ModifierArgument",
      "name": "returns",
      "params": [
        {
          "type": "Identifier",
          "name": "uint",
          "start": 41,
          "end": 45
        }
      ],
      "start": 33,
      "end": 46
    }
  ],
  "body": { /* omitted */ }
  "is_abstract": false,
  "start": 20,
  "end": 72
}

The return type should not be parsed as another modifier, and its arguments are types, not expressions. See here.