raineorshine/solgraph

Object construction syntax error

subhodi opened this issue · 4 comments

Here is my code:

contract MyContract {
  uint balance;
  struct User {
      address addr;
      bytes32 name;
      uint id;
  }
  User owner;
  function MyContract(bytes32 _name, uint _id) {
    owner = User({addr:msg.sender, name:_name, id:_id});
    Mint(1000000);
  }

  function Mint(uint amount) internal {
    balance = amount;
  }

  function Withdraw() {
    msg.sender.send(balance);
  }

  function GetBalance() constant returns(uint) {
    return balance;
  }
}

Error output:
found: '{',
location:
{ start: { offset: 202, line: 10, column: 18 },
end: { offset: 203, line: 10, column: 19 } },
name: 'SyntaxError' }

Solgraph will work if i change the contract code line 10 to

owner = User(msg.sender, _name, _id);

same problem with struct construction

transferProposal = Proposal({
            dcorpAddress: _dcorpAddress,
            deadline: now + transferProposalEnd,
            approvedWeight: 0,
            disapprovedWeight: 0
        });

+1 same issue when constructing struct, would there be a fix?

This will be fixed when solidity-parser is upgraded in #17 or #20.

Fixed in v0.3.0