Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve support for legacy ast #720

Merged
merged 2 commits into from
Dec 4, 2020
Merged

Improve support for legacy ast #720

merged 2 commits into from
Dec 4, 2020

Conversation

montyly
Copy link
Contributor

@montyly montyly commented Dec 4, 2020

From Solidity 0.6.3 to 0.6.10 (included) the comment above events and functions are added to the children of the event/signature in the legacy Ast.

Example:

contract A{
    /*** Events ***/
    event E();

    /*** Function ***/
    function f() public{}
}
======= test.sol =======
{
  "attributes":
  {
    "absolutePath": "test.sol",
    "exportedSymbols":
    {
      "A":
      [
        9
      ]
    }
  },
  "children":
  [
    {
      "attributes":
      {
        "abstract": false,
        "baseContracts":
        [
          null
        ],
        "contractDependencies":
        [
          null
        ],
        "contractKind": "contract",
        "documentation": null,
        "fullyImplemented": true,
        "linearizedBaseContracts":
        [
          9
        ],
        "name": "A",
        "scope": 10
      },
      "children":
      [
        {
          "attributes":
          {
            "anonymous": false,
            "name": "E"
          },
          "children":
          [
            {
              "attributes":
              {
                "text": "* Events **"
              },
              "id": 1,
              "name": "StructuredDocumentation",
              "src": "16:16:0"
            },
            {
              "attributes":
              {
                "parameters":
                [
                  null
                ]
              },
              "children": [],
              "id": 2,
              "name": "ParameterList",
              "src": "44:2:0"
            }
          ],
          "id": 3,
          "name": "EventDefinition",
          "src": "37:10:0"
        },
        {
          "attributes":
          {
            "functionSelector": "26121ff0",
            "implemented": true,
            "isConstructor": false,
            "kind": "function",
            "modifiers":
            [
              null
            ],
            "name": "f",
            "overrides": null,
            "scope": 9,
            "stateMutability": "nonpayable",
            "virtual": false,
            "visibility": "public"
          },
          "children":
          [
            {
              "attributes":
              {
                "text": "* Function **"
              },
              "id": 4,
              "name": "StructuredDocumentation",
              "src": "53:18:0"
            },
            {
              "attributes":
              {
                "parameters":
                [
                  null
                ]
              },
              "children": [],
              "id": 5,
              "name": "ParameterList",
              "src": "86:2:0"
            },
            {
              "attributes":
              {
                "parameters":
                [
                  null
                ]
              },
              "children": [],
              "id": 6,
              "name": "ParameterList",
              "src": "95:0:0"
            },
            {
              "attributes":
              {
                "statements":
                [
                  null
                ]
              },
              "children": [],
              "id": 7,
              "name": "Block",
              "src": "95:2:0"
            }
          ],
          "id": 8,
          "name": "FunctionDefinition",
          "src": "76:21:0"
        }
      ],
      "id": 9,
      "name": "ContractDefinition",
      "src": "0:99:0"
    }
  ],
  "id": 10,
  "name": "SourceUnit",
  "src": "0:100:0"
}

@montyly montyly merged commit 7fa10b0 into dev Dec 4, 2020
@montyly montyly deleted the dev-fix-legacy-ast-comment branch December 7, 2020 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant