add comments

pull/7/head
yann300 8 years ago
parent 25b7f8e867
commit 8b22007cba
  1. 14
      src/solidity/types/util.js
  2. 10
      src/util/astWalker.js

@ -33,6 +33,13 @@ function readFromStorage (slot, storageContent) {
}
}
/**
* @returns a hex encoded byte slice of length @arg byteLength from inside @arg slotValue.
*
* @param {String} slotValue - right aligned hex encoded value to extract the byte slice from (can have 0x prefix)
* @param {Int} byteLength - Length of the byte slice to extract
* @param {Int} offsetFromLSB - byte distance from the right end slot value to the right end of the byte slice
*/
function extractHexByteSlice (slotValue, byteLength, offsetFromLSB) {
slotValue = slotValue.replace('0x', '')
if (slotValue.length < 64) {
@ -42,6 +49,13 @@ function extractHexByteSlice (slotValue, byteLength, offsetFromLSB) {
return slotValue.substr(offset, 2 * byteLength)
}
/**
* @returns a hex encoded storage content at the given @arg location. it does not have Ox prefix but always has the full length.
*
* @param {Object} location - object containing the slot and offset of the data to extract.
* @param {Object} storageContent - full storage mapping.
* @param {Int} byteLength - Length of the byte slice to extract
*/
function extractHexByte (location, storageContent, byteLength) {
var slotvalue = readFromStorage(location.slot, storageContent)
return extractHexByteSlice(slotvalue, byteLength, location.offset)

@ -31,11 +31,11 @@ AstWalker.prototype.walk = function (ast, callback) {
}
/**
+ * walk the given @astList
+ *
+ * @param {Object} sourcesList - sources list (containing root AST node)
+ * @param {Function} - callback used by AstWalker to compute response
+ */
* walk the given @astList
*
* @param {Object} sourcesList - sources list (containing root AST node)
* @param {Function} - callback used by AstWalker to compute response
*/
AstWalker.prototype.walkAstList = function (sourcesList, callback) {
var walker = new AstWalker()
for (var k in sourcesList) {

Loading…
Cancel
Save