duaraghav8 / Ethlint

(Formerly Solium) Code quality & Security Linter for Solidity
https://ethlint.readthedocs.io/en/latest/
MIT License
927 stars 128 forks source link

Linting assembly code fails #80

Closed elenadimitrova closed 7 years ago

elenadimitrova commented 7 years ago

The following error is thrown when running solium@0.4.0 against contract containing Solidity assembly code:

An error occurred while running the linter on /Router.sol:
Error: An error occured while parsing the source code:
SyntaxError: Expected "!=", "!==", "%", "%=", "&", "&&", "&=", "(", "*", "**", "*=", "+", "++", "+=", ",", "-", "--", "-=", ".", "/", "/*", "//", "/=", ":", ";", "<", "<<", "<<=", "<=", "=", "==", "===", ">", ">=", ">>", ">>=", ">>>", ">>>=", "?", "[", "^", "^=", "constant", "in", "instanceof", "internal", "memory", "private", "public", "|", "|=", "||", comment, end of line, identifier or whitespace but "{" found. Line: 7, Column: 14
    at EventEmitter.lint (/Users/Elena/colonySale/node_modules/solium/lib/solium.js:88:10)
    at lintString (/Users/Elena/colonySale/node_modules/solium/lib/cli.js:126:24)
    at lintFile (/Users/Elena/colonySale/node_modules/solium/lib/cli.js:157:9)
    at /Users/Elena/colonySale/node_modules/solium/lib/cli.js:176:45
    at Array.map (native)
    at lint (/Users/Elena/colonySale/node_modules/solium/lib/cli.js:176:33)
    at Object.execute (/Users/Elena/colonySale/node_modules/solium/lib/cli.js:287:19)
    at Object.<anonymous> (/Users/Elena/colonySale/node_modules/solium/bin/solium.js:11:5)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
No issues found.

Line 7 where the error is thrown is the assembly block in the following simplified contract

pragma solidity ^0.4.11;

contract Router {

  function() payable {
    uint r;
    assembly {
      calldatacopy(mload(0x40), 0, calldatasize)
      r := delegatecall(sub(gas, 700), destination, mload(0x40), calldatasize, mload(0x40), outsize)
    }
  }
}
duaraghav8 commented 7 years ago

will be available in v0.5.0 (set to release in next 4 days). Thanks for reporting this @elenadimitrova :)

duaraghav8 commented 7 years ago

0.5.0 is now available and has resolved this issue