Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/lib/contract/contract-comment.es6
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,18 @@ export class ContractComment {
let oldCommentPosition = line - 1;
while (true) {
let comment = this.contract.getLineAt(oldCommentPosition).trim();
if (comment.startsWith(parameterCommentRegex)) {
oldCommentsParams.push({line: oldCommentPosition, value: comment});
if (comment.startsWith('/**')) {
// multiline /** comments
return true;
} else if (comment.startsWith(parameterCommentRegex)) {
// param comments
oldCommentsParams.push({ line: oldCommentPosition, value: comment });
} else if (comment.startsWith('//')) {
oldCommentsMap[comment.match(generatedCommentRegex)[0]] = comment;
// other comments
let matchedComment = comment.match(generatedCommentRegex);
if (matchedComment != null) {
oldCommentsMap[matchedComment[0]] = comment;
}
} else if (!comment.startsWith('function')) {
break;
}
Expand Down
15 changes: 14 additions & 1 deletion test/test-contracts/Metacoin.edited.commented.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
pragma solidity ^0.4.24;


/// @title MetaCoin v.2
/**
* Different type of comments
* MetaCoin contract is used to....
*/
contract MetaCoin {

/// @notice
mapping (address => uint) balances;

// @notice
// This is multiline comment
mapping (address => uint) tokens;

event Transfer(address _from,address _to, uint _amount);

/// @notice
Expand All @@ -16,6 +23,12 @@ contract MetaCoin {
balances[tx.origin] = 10000;
}

/// @param receiver
/// Another multiline comment, this one is about param receiver
function addToken(address receiver) public {
tokens[receiver] = tokens[receiver] + 1;
}

/// @notice
/// @dev
/// @param receiver
Expand Down
15 changes: 14 additions & 1 deletion test/test-contracts/Metacoin.edited.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
pragma solidity ^0.4.24;


/// @title MetaCoin v.2
/**
* Different type of comments
* MetaCoin contract is used to....
*/
contract MetaCoin {

mapping (address => uint) balances;

// @notice
// This is multiline comment
mapping (address => uint) tokens;

event Transfer(address _from,address _to, uint _amount);

/// @notice
Expand All @@ -15,6 +22,12 @@ contract MetaCoin {
balances[tx.origin] = 10000;
}

/// @param receiver
/// Another multiline comment, this one is about param receiver
function addToken(address receiver) public {
tokens[receiver] = tokens[receiver] + 1;
}

/// @notice
/// @dev
/// @param receiver
Expand Down