Repository: crytic/slither

Issue:
Issue with NEW VARIABLE declaration
```
pragma solidity ^0.4.24;

contract PoC {
    
    function withdrawBalance(uint256 element, uint amount) public{
        uint local_c;
        local_c = amount;
    }    
}
```

For the following contract, the corresponding slither expression generated is the following:
```
ENTRY_POINT None
NEW VARIABLE None
EXPRESSION local_c = amount
```
Isn't it `NEW VARIABLE` should be followed by the variable `local_c`? Instead, it is showing `NEW VARIABLE None`
Issue with NEW VARIABLE declaration
```
pragma solidity ^0.4.24;

contract PoC {
    
    function withdrawBalance(uint256 element, uint amount) public{
        uint local_c;
        local_c = amount;
    }    
}
```

For the following contract, the corresponding slither expression generated is the following:
```
ENTRY_POINT None
NEW VARIABLE None
EXPRESSION local_c = amount
```
Isn't it `NEW VARIABLE` should be followed by the variable `local_c`? Instead, it is showing `NEW VARIABLE None`


Discussion:

Resolving patch:
diff --git a/slither/core/cfg/node.py b/slither/core/cfg/node.py
--- a/slither/core/cfg/node.py
+++ b/slither/core/cfg/node.py
@@ -914,7 +914,12 @@ def update_read_write_using_ssa(self):
     ###################################################################################
 
     def __str__(self):
-        txt = NodeType.str(self._node_type) + ' ' + str(self.expression)
+        additional_info = ''
+        if self.expression:
+            additional_info += ' ' + str(self.expression)
+        elif self.variable_declaration:
+            additional_info += ' ' + str(self.variable_declaration)
+        txt = NodeType.str(self._node_type) + additional_info
         return txt
 
     # endregion


Test patch:
diff --git a/scripts/tests_generate_expected_json_5.sh b/scripts/tests_generate_expected_json_5.sh
--- a/scripts/tests_generate_expected_json_5.sh
+++ b/scripts/tests_generate_expected_json_5.sh
@@ -20,23 +20,23 @@ generate_expected_json(){
     sed "s|$CURRENT_PATH|$TRAVIS_PATH|g" "$output_filename_txt" -i
 }
 
-#generate_expected_json tests/void-cst.sol "void-cst"
-#generate_expected_json tests/solc_version_incorrect_05.ast.json "solc-version"
-#generate_expected_json tests/uninitialized-0.5.1.sol "uninitialized-state"
-#generate_expected_json tests/backdoor.sol "backdoor"
-#generate_expected_json tests/backdoor.sol "suicidal"
-#generate_expected_json tests/old_solc.sol.json "solc-version"
-#generate_expected_json tests/reentrancy-0.5.1.sol "reentrancy-eth"
-#generate_expected_json tests/reentrancy-0.5.1-events.sol "reentrancy-events"
-#generate_expected_json tests/tx_origin-0.5.1.sol "tx-origin"
-#generate_expected_json tests/locked_ether-0.5.1.sol "locked-ether"
-#generate_expected_json tests/arbitrary_send-0.5.1.sol "arbitrary-send"
-#generate_expected_json tests/inline_assembly_contract-0.5.1.sol "assembly"
-#generate_expected_json tests/inline_assembly_library-0.5.1.sol "assembly"
-#generate_expected_json tests/constant-0.5.1.sol "constant-function-asm"
-#generate_expected_json tests/constant-0.5.1.sol "constant-function-state"
-#generate_expected_json tests/incorrect_equality.sol "incorrect-equality"
-#generate_expected_json tests/too_many_digits.sol "too-many-digits"
-#generate_expected_json tests/unchecked_lowlevel-0.5.1.sol "unchecked-lowlevel"
-#generate_expected_json tests/unchecked_send-0.5.1.sol "unchecked-send"
+generate_expected_json tests/void-cst.sol "void-cst"
+generate_expected_json tests/solc_version_incorrect_05.ast.json "solc-version"
+generate_expected_json tests/uninitialized-0.5.1.sol "uninitialized-state"
+generate_expected_json tests/backdoor.sol "backdoor"
+generate_expected_json tests/backdoor.sol "suicidal"
+generate_expected_json tests/old_solc.sol.json "solc-version"
+generate_expected_json tests/reentrancy-0.5.1.sol "reentrancy-eth"
+generate_expected_json tests/reentrancy-0.5.1-events.sol "reentrancy-events"
+generate_expected_json tests/tx_origin-0.5.1.sol "tx-origin"
+generate_expected_json tests/locked_ether-0.5.1.sol "locked-ether"
+generate_expected_json tests/arbitrary_send-0.5.1.sol "arbitrary-send"
+generate_expected_json tests/inline_assembly_contract-0.5.1.sol "assembly"
+generate_expected_json tests/inline_assembly_library-0.5.1.sol "assembly"
+generate_expected_json tests/constant-0.5.1.sol "constant-function-asm"
+generate_expected_json tests/constant-0.5.1.sol "constant-function-state"
+generate_expected_json tests/incorrect_equality.sol "incorrect-equality"
+generate_expected_json tests/too_many_digits.sol "too-many-digits"
+generate_expected_json tests/unchecked_lowlevel-0.5.1.sol "unchecked-lowlevel"
+generate_expected_json tests/unchecked_send-0.5.1.sol "unchecked-send"
 
diff --git a/tests/expected_json/deprecated_calls.deprecated-standards.json b/tests/expected_json/deprecated_calls.deprecated-standards.json
--- a/tests/expected_json/deprecated_calls.deprecated-standards.json
+++ b/tests/expected_json/deprecated_calls.deprecated-standards.json
@@ -272,9 +272,9 @@
             }
           }
         ],
-        "description": "Deprecated standard detected THROW None (tests/deprecated_calls.sol#9):\n\t- Usage of \"throw\" should be replaced with \"revert()\"\n",
-        "markdown": "Deprecated standard detected [THROW None](tests/deprecated_calls.sol#L9):\n\t- Usage of \"throw\" should be replaced with \"revert()\"\n",
-        "id": "1a3241d58683640c33ae9e1bcd65bafd7472e7b7c9d2ec695f84590a2cef286a",
+        "description": "Deprecated standard detected THROW (tests/deprecated_calls.sol#9):\n\t- Usage of \"throw\" should be replaced with \"revert()\"\n",
+        "markdown": "Deprecated standard detected [THROW](tests/deprecated_calls.sol#L9):\n\t- Usage of \"throw\" should be replaced with \"revert()\"\n",
+        "id": "7706e581277e0b0d8c2f8fbb8afee6a8a47e638fd6a407927716c8cd1bfbad5b",
         "check": "deprecated-standards",
         "impact": "Informational",
         "confidence": "High"
diff --git a/tests/expected_json/deprecated_calls.deprecated-standards.txt b/tests/expected_json/deprecated_calls.deprecated-standards.txt
--- a/tests/expected_json/deprecated_calls.deprecated-standards.txt
+++ b/tests/expected_json/deprecated_calls.deprecated-standards.txt
@@ -3,7 +3,7 @@ Deprecated standard detected ContractWithDeprecatedReferences.globalBlockHash (t
 	- Usage of "block.blockhash()" should be replaced with "blockhash()"
 Deprecated standard detected msg.gas == msg.value (tests/deprecated_calls.sol#7):
 	- Usage of "msg.gas" should be replaced with "gasleft()"
-Deprecated standard detected THROW None (tests/deprecated_calls.sol#9):
+Deprecated standard detected THROW (tests/deprecated_calls.sol#9):
 	- Usage of "throw" should be replaced with "revert()"
 Deprecated standard detected sha3Result = sha3()(test deprecated sha3 usage) (tests/deprecated_calls.sol#16):
 	- Usage of "sha3()" should be replaced with "keccak256()"
diff --git a/tests/expected_json/inline_assembly_contract-0.5.1.assembly.json b/tests/expected_json/inline_assembly_contract-0.5.1.assembly.json
--- a/tests/expected_json/inline_assembly_contract-0.5.1.assembly.json
+++ b/tests/expected_json/inline_assembly_contract-0.5.1.assembly.json
@@ -177,9 +177,9 @@
             }
           }
         ],
-        "description": "GetCode.at(address) (tests/inline_assembly_contract-0.5.1.sol#6-20) uses assembly\n\t- INLINE ASM None (tests/inline_assembly_contract-0.5.1.sol#7-20)\n",
-        "markdown": "[GetCode.at(address)](tests/inline_assembly_contract-0.5.1.sol#L6-L20) uses assembly\n\t- [INLINE ASM None](tests/inline_assembly_contract-0.5.1.sol#L7-L20)\n",
-        "id": "8f8a296feb87f8865449404161841580a3bb405864ed5f2622fdffdbe6a93ad8",
+        "description": "GetCode.at(address) (tests/inline_assembly_contract-0.5.1.sol#6-20) uses assembly\n\t- INLINE ASM (tests/inline_assembly_contract-0.5.1.sol#7-20)\n",
+        "markdown": "[GetCode.at(address)](tests/inline_assembly_contract-0.5.1.sol#L6-L20) uses assembly\n\t- [INLINE ASM](tests/inline_assembly_contract-0.5.1.sol#L7-L20)\n",
+        "id": "4b643a419f44f94dddac3c6b65dc0c08630e555a80a724770a59e42c87efdd8d",
         "check": "assembly",
         "impact": "Informational",
         "confidence": "High"
diff --git a/tests/expected_json/inline_assembly_contract-0.5.1.assembly.txt b/tests/expected_json/inline_assembly_contract-0.5.1.assembly.txt
--- a/tests/expected_json/inline_assembly_contract-0.5.1.assembly.txt
+++ b/tests/expected_json/inline_assembly_contract-0.5.1.assembly.txt
@@ -1,6 +1,6 @@
 [92m
 GetCode.at(address) (tests/inline_assembly_contract-0.5.1.sol#6-20) uses assembly
-	- INLINE ASM None (tests/inline_assembly_contract-0.5.1.sol#7-20)
+	- INLINE ASM (tests/inline_assembly_contract-0.5.1.sol#7-20)
 Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage[0m
 tests/inline_assembly_contract-0.5.1.sol analyzed (1 contracts with 1 detectors), 1 result(s) found
 [94mUse https://crytic.io/ to get access to additional detectors and Github integration[0m
diff --git a/tests/expected_json/inline_assembly_contract.assembly.json b/tests/expected_json/inline_assembly_contract.assembly.json
--- a/tests/expected_json/inline_assembly_contract.assembly.json
+++ b/tests/expected_json/inline_assembly_contract.assembly.json
@@ -177,9 +177,9 @@
             }
           }
         ],
-        "description": "GetCode.at(address) (tests/inline_assembly_contract.sol#6-20) uses assembly\n\t- INLINE ASM None (tests/inline_assembly_contract.sol#7-20)\n",
-        "markdown": "[GetCode.at(address)](tests/inline_assembly_contract.sol#L6-L20) uses assembly\n\t- [INLINE ASM None](tests/inline_assembly_contract.sol#L7-L20)\n",
-        "id": "8f448cbd104ddfcc1c099119fcb367b581476208f7cc3ab5897f4a9b5b4a9080",
+        "description": "GetCode.at(address) (tests/inline_assembly_contract.sol#6-20) uses assembly\n\t- INLINE ASM (tests/inline_assembly_contract.sol#7-20)\n",
+        "markdown": "[GetCode.at(address)](tests/inline_assembly_contract.sol#L6-L20) uses assembly\n\t- [INLINE ASM](tests/inline_assembly_contract.sol#L7-L20)\n",
+        "id": "120ffc7cb84fd731d6bceda1619aad83e9c652035bd108b3b1d98e1191037414",
         "check": "assembly",
         "impact": "Informational",
         "confidence": "High"
diff --git a/tests/expected_json/inline_assembly_contract.assembly.txt b/tests/expected_json/inline_assembly_contract.assembly.txt
--- a/tests/expected_json/inline_assembly_contract.assembly.txt
+++ b/tests/expected_json/inline_assembly_contract.assembly.txt
@@ -1,6 +1,6 @@
 [92m
 GetCode.at(address) (tests/inline_assembly_contract.sol#6-20) uses assembly
-	- INLINE ASM None (tests/inline_assembly_contract.sol#7-20)
+	- INLINE ASM (tests/inline_assembly_contract.sol#7-20)
 Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage[0m
 tests/inline_assembly_contract.sol analyzed (1 contracts with 1 detectors), 1 result(s) found
 [94mUse https://crytic.io/ to get access to additional detectors and Github integration[0m
diff --git a/tests/expected_json/inline_assembly_library-0.5.1.assembly.json b/tests/expected_json/inline_assembly_library-0.5.1.assembly.json
--- a/tests/expected_json/inline_assembly_library-0.5.1.assembly.json
+++ b/tests/expected_json/inline_assembly_library-0.5.1.assembly.json
@@ -205,9 +205,9 @@
             }
           }
         ],
-        "description": "VectorSum.sumAsm(uint256[]) (tests/inline_assembly_library-0.5.1.sol#16-22) uses assembly\n\t- INLINE ASM None (tests/inline_assembly_library-0.5.1.sol#18-21)\n",
-        "markdown": "[VectorSum.sumAsm(uint256[])](tests/inline_assembly_library-0.5.1.sol#L16-L22) uses assembly\n\t- [INLINE ASM None](tests/inline_assembly_library-0.5.1.sol#L18-L21)\n",
-        "id": "2d646463bf10753d2433783ea4a212d84dfb51269bb062f4ea5db21bd8ec6cb6",
+        "description": "VectorSum.sumAsm(uint256[]) (tests/inline_assembly_library-0.5.1.sol#16-22) uses assembly\n\t- INLINE ASM (tests/inline_assembly_library-0.5.1.sol#18-21)\n",
+        "markdown": "[VectorSum.sumAsm(uint256[])](tests/inline_assembly_library-0.5.1.sol#L16-L22) uses assembly\n\t- [INLINE ASM](tests/inline_assembly_library-0.5.1.sol#L18-L21)\n",
+        "id": "a2c27ffe8615215fd68eda3be4940a066519cf8debebd6f442854ce49014c5c6",
         "check": "assembly",
         "impact": "Informational",
         "confidence": "High"
@@ -464,9 +464,9 @@
             }
           }
         ],
-        "description": "VectorSum.sumPureAsm(uint256[]) (tests/inline_assembly_library-0.5.1.sol#25-47) uses assembly\n\t- INLINE ASM None (tests/inline_assembly_library-0.5.1.sol#26-47)\n",
-        "markdown": "[VectorSum.sumPureAsm(uint256[])](tests/inline_assembly_library-0.5.1.sol#L25-L47) uses assembly\n\t- [INLINE ASM None](tests/inline_assembly_library-0.5.1.sol#L26-L47)\n",
-        "id": "df1118184108ae4b7b7300da137ebfc86c3279fcaffabf289d8e79bc23228105",
+        "description": "VectorSum.sumPureAsm(uint256[]) (tests/inline_assembly_library-0.5.1.sol#25-47) uses assembly\n\t- INLINE ASM (tests/inline_assembly_library-0.5.1.sol#26-47)\n",
+        "markdown": "[VectorSum.sumPureAsm(uint256[])](tests/inline_assembly_library-0.5.1.sol#L25-L47) uses assembly\n\t- [INLINE ASM](tests/inline_assembly_library-0.5.1.sol#L26-L47)\n",
+        "id": "6a84eb447df8d10565d051e120c9cca03491514c7494748b363d7aad63613032",
         "check": "assembly",
         "impact": "Informational",
         "confidence": "High"
diff --git a/tests/expected_json/inline_assembly_library-0.5.1.assembly.txt b/tests/expected_json/inline_assembly_library-0.5.1.assembly.txt
--- a/tests/expected_json/inline_assembly_library-0.5.1.assembly.txt
+++ b/tests/expected_json/inline_assembly_library-0.5.1.assembly.txt
@@ -1,8 +1,8 @@
 [92m
 VectorSum.sumAsm(uint256[]) (tests/inline_assembly_library-0.5.1.sol#16-22) uses assembly
-	- INLINE ASM None (tests/inline_assembly_library-0.5.1.sol#18-21)
+	- INLINE ASM (tests/inline_assembly_library-0.5.1.sol#18-21)
 VectorSum.sumPureAsm(uint256[]) (tests/inline_assembly_library-0.5.1.sol#25-47) uses assembly
-	- INLINE ASM None (tests/inline_assembly_library-0.5.1.sol#26-47)
+	- INLINE ASM (tests/inline_assembly_library-0.5.1.sol#26-47)
 Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage[0m
 tests/inline_assembly_library-0.5.1.sol analyzed (1 contracts with 1 detectors), 2 result(s) found
 [94mUse https://crytic.io/ to get access to additional detectors and Github integration[0m
diff --git a/tests/expected_json/inline_assembly_library.assembly.json b/tests/expected_json/inline_assembly_library.assembly.json
--- a/tests/expected_json/inline_assembly_library.assembly.json
+++ b/tests/expected_json/inline_assembly_library.assembly.json
@@ -205,9 +205,9 @@
             }
           }
         ],
-        "description": "VectorSum.sumAsm(uint256[]) (tests/inline_assembly_library.sol#16-22) uses assembly\n\t- INLINE ASM None (tests/inline_assembly_library.sol#18-21)\n",
-        "markdown": "[VectorSum.sumAsm(uint256[])](tests/inline_assembly_library.sol#L16-L22) uses assembly\n\t- [INLINE ASM None](tests/inline_assembly_library.sol#L18-L21)\n",
-        "id": "3ff39c86f26b81703ac5df9ce9d176a0a2c9948abccc76da3768272588588c04",
+        "description": "VectorSum.sumAsm(uint256[]) (tests/inline_assembly_library.sol#16-22) uses assembly\n\t- INLINE ASM (tests/inline_assembly_library.sol#18-21)\n",
+        "markdown": "[VectorSum.sumAsm(uint256[])](tests/inline_assembly_library.sol#L16-L22) uses assembly\n\t- [INLINE ASM](tests/inline_assembly_library.sol#L18-L21)\n",
+        "id": "16a8c992317c2aaf582eae9181ebe0e8fb3a06fdfd33146b6dd3fb79c0827848",
         "check": "assembly",
         "impact": "Informational",
         "confidence": "High"
@@ -464,9 +464,9 @@
             }
           }
         ],
-        "description": "VectorSum.sumPureAsm(uint256[]) (tests/inline_assembly_library.sol#25-47) uses assembly\n\t- INLINE ASM None (tests/inline_assembly_library.sol#26-47)\n",
-        "markdown": "[VectorSum.sumPureAsm(uint256[])](tests/inline_assembly_library.sol#L25-L47) uses assembly\n\t- [INLINE ASM None](tests/inline_assembly_library.sol#L26-L47)\n",
-        "id": "423795860d3892652fcf5005055c4781586100070e0ecdffb7ca1014c3958191",
+        "description": "VectorSum.sumPureAsm(uint256[]) (tests/inline_assembly_library.sol#25-47) uses assembly\n\t- INLINE ASM (tests/inline_assembly_library.sol#26-47)\n",
+        "markdown": "[VectorSum.sumPureAsm(uint256[])](tests/inline_assembly_library.sol#L25-L47) uses assembly\n\t- [INLINE ASM](tests/inline_assembly_library.sol#L26-L47)\n",
+        "id": "ff7093c29957035d9db28e32bf4e530e073a51cf5d481355be56b011508200ce",
         "check": "assembly",
         "impact": "Informational",
         "confidence": "High"
diff --git a/tests/expected_json/inline_assembly_library.assembly.txt b/tests/expected_json/inline_assembly_library.assembly.txt
--- a/tests/expected_json/inline_assembly_library.assembly.txt
+++ b/tests/expected_json/inline_assembly_library.assembly.txt
@@ -1,8 +1,8 @@
 [92m
 VectorSum.sumAsm(uint256[]) (tests/inline_assembly_library.sol#16-22) uses assembly
-	- INLINE ASM None (tests/inline_assembly_library.sol#18-21)
+	- INLINE ASM (tests/inline_assembly_library.sol#18-21)
 VectorSum.sumPureAsm(uint256[]) (tests/inline_assembly_library.sol#25-47) uses assembly
-	- INLINE ASM None (tests/inline_assembly_library.sol#26-47)
+	- INLINE ASM (tests/inline_assembly_library.sol#26-47)
 Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage[0m
 tests/inline_assembly_library.sol analyzed (1 contracts with 1 detectors), 2 result(s) found
 [94mUse https://crytic.io/ to get access to additional detectors and Github integration[0m