Consensys / vscode-solidity-auditor

Solidity language support and visual security auditor for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor
GNU General Public License v3.0
569 stars 60 forks source link

`uml` does not work properly #106

Closed johnzhu0907 closed 1 year ago

johnzhu0907 commented 1 year ago

Hi, there. I have found an issue about uml tool. The source contract is:

contract A is Base {
  using SafeMath for *;
  //...
}

When I click uml link, no diagram is rendered and there is an error in the output: image After searching the source code, I think maybe there is a bug in the following code snippet.

function getVariableDeclarationType(node) {
    if (typeof node.typeName != "undefined") {
        if (varDecIsArray(node)) {
            node = node.typeName.baseTypeName;
        } else {
            node = node.typeName;
        }
    }

    if (node.type == "ElementaryTypeName") {
        return node.name;
    } else if (node.type == "UserDefinedTypeName") {
        return node.namePath;
    } else if (node.type == "Mapping") {
        node.namePath = "mapping( " + getVariableDeclarationType(node.keyType) + "=>" + getVariableDeclarationType(node.valueType) + " )";
        return node.namePath;
    } else {
        return null;
    }
}

function getVariableDeclarationType(node) { Can anyone have a look? Thanks.