UNPKG

astexplorer.app

Version:

https://astexplorer.net with ES Modules support and Hot Reloading

1 lines 962 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([[39],{"./node_modules/node-libs-browser/mock/empty.js":function(module,exports){eval("\n\n//# sourceURL=webpack:///./node_modules/node-libs-browser/mock/empty.js?")},"./node_modules/path-browserify/index.js":function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,\n// backported and transplited with Babel, with backwards-compat fixes\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function (path) {\n if (typeof path !== 'string') path = path + '';\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) {\n // return '//';\n // Backwards-compat fix:\n return '/';\n }\n return path.slice(0, end);\n};\n\nfunction basename(path) {\n if (typeof path !== 'string') path = path + '';\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n}\n\n// Uses a mixed approach for backwards-compatibility, as ext behavior changed\n// in new Node.js versions, so only basename() above is backported here\nexports.basename = function (path, ext) {\n var f = basename(path);\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\nexports.extname = function (path) {\n if (typeof path !== 'string') path = path + '';\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(\"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./node_modules/path-browserify/index.js?")},"./node_modules/process/browser.js":function(module,exports){eval("// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n//# sourceURL=webpack:///./node_modules/process/browser.js?")},"./node_modules/solidity-parser-antlr/dist/ASTBuilder.js":function(module,exports,__webpack_require__){"use strict";eval("\n\nvar antlr4 = __webpack_require__(\"./node_modules/solidity-parser-antlr/dist/antlr4/index.js\");\n\nfunction toText(ctx) {\n if (ctx !== null) {\n return ctx.getText();\n }\n return null;\n}\n\nfunction mapCommasToNulls(children) {\n if (children.length === 0) {\n return [];\n }\n\n var values = [];\n var comma = true;\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var el = _step.value;\n\n if (comma) {\n if (toText(el) === ',') {\n values.push(null);\n } else {\n values.push(el);\n comma = false;\n }\n } else {\n if (toText(el) !== ',') {\n throw new Error('expected comma');\n }\n comma = true;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n if (comma) {\n values.push(null);\n }\n\n return values;\n}\n\nfunction isBinOp(op) {\n var binOps = ['+', '-', '*', '/', '**', '%', '<<', '>>', '&&', '||', '&', '|', '^', '<', '>', '<=', '>=', '==', '!=', '=', '|=', '^=', '&=', '<<=', '>>=', '+=', '-=', '*=', '/=', '%='];\n return binOps.includes(op);\n}\n\nvar transformAST = {\n SourceUnit: function SourceUnit(ctx) {\n // last element is EOF terminal node\n return {\n children: this.visit(ctx.children.slice(0, -1))\n };\n },\n EnumDefinition: function EnumDefinition(ctx) {\n return {\n name: toText(ctx.identifier()),\n members: this.visit(ctx.enumValue())\n };\n },\n EnumValue: function EnumValue(ctx) {\n return {\n name: toText(ctx.identifier())\n };\n },\n UsingForDeclaration: function UsingForDeclaration(ctx) {\n var typeName = null;\n if (toText(ctx.getChild(3)) !== '*') {\n typeName = this.visit(ctx.getChild(3));\n }\n\n return {\n typeName: typeName,\n libraryName: toText(ctx.identifier())\n };\n },\n PragmaDirective: function PragmaDirective(ctx) {\n return {\n name: toText(ctx.pragmaName()),\n value: toText(ctx.pragmaValue())\n };\n },\n ContractDefinition: function ContractDefinition(ctx) {\n var name = toText(ctx.identifier());\n this._currentContract = name;\n\n return {\n name: name,\n baseContracts: this.visit(ctx.inheritanceSpecifier()),\n subNodes: this.visit(ctx.contractPart()),\n kind: toText(ctx.getChild(0))\n };\n },\n InheritanceSpecifier: function InheritanceSpecifier(ctx) {\n var exprList = ctx.expressionList();\n var args = exprList != null ? this.visit(exprList.expression()) : [];\n\n return {\n baseName: this.visit(ctx.userDefinedTypeName()),\n arguments: args\n };\n },\n ContractPart: function ContractPart(ctx) {\n return this.visit(ctx.children[0]);\n },\n ConstructorDefinition: function ConstructorDefinition(ctx) {\n var _this = this;\n\n var parameters = this.visit(ctx.parameterList());\n var block = this.visit(ctx.block());\n\n var modifiers = ctx.modifierList().modifierInvocation().map(function (mod) {\n return _this.visit(mod);\n });\n\n // parse function visibility\n var visibility = 'default';\n if (ctx.modifierList().ExternalKeyword(0)) {\n visibility = 'external';\n } else if (ctx.modifierList().InternalKeyword(0)) {\n visibility = 'internal';\n } else if (ctx.modifierList().PublicKeyword(0)) {\n visibility = 'public';\n } else if (ctx.modifierList().PrivateKeyword(0)) {\n visibility = 'private';\n }\n\n var stateMutability = null;\n if (ctx.modifierList().stateMutability(0)) {\n stateMutability = toText(ctx.modifierList().stateMutability(0));\n }\n\n return {\n type: 'FunctionDefinition',\n name: null,\n parameters: parameters,\n body: block,\n visibility: visibility,\n modifiers: modifiers,\n isConstructor: true,\n stateMutability: stateMutability\n };\n },\n FunctionDefinition: function FunctionDefinition(ctx) {\n var _this2 = this;\n\n var name = '';\n if (ctx.identifier(0)) {\n name = toText(ctx.identifier(0));\n }\n var parameters = this.visit(ctx.parameterList());\n\n var returnParameters = this.visit(ctx.returnParameters());\n\n var block = null;\n if (ctx.block()) {\n block = this.visit(ctx.block());\n }\n\n var modifiers = ctx.modifierList().modifierInvocation().map(function (mod) {\n return _this2.visit(mod);\n });\n\n // parse function visibility\n var visibility = 'default';\n if (ctx.modifierList().ExternalKeyword(0)) {\n visibility = 'external';\n } else if (ctx.modifierList().InternalKeyword(0)) {\n visibility = 'internal';\n } else if (ctx.modifierList().PublicKeyword(0)) {\n visibility = 'public';\n } else if (ctx.modifierList().PrivateKeyword(0)) {\n visibility = 'private';\n }\n\n var stateMutability = null;\n if (ctx.modifierList().stateMutability(0)) {\n stateMutability = toText(ctx.modifierList().stateMutability(0));\n }\n\n return {\n name: name,\n parameters: parameters,\n returnParameters: returnParameters,\n body: block,\n visibility: visibility,\n modifiers: modifiers,\n isConstructor: name === this._currentContract,\n stateMutability: stateMutability\n };\n },\n ModifierInvocation: function ModifierInvocation(ctx) {\n var exprList = ctx.expressionList();\n\n var args = void 0;\n if (exprList != null) {\n args = this.visit(exprList.expression());\n } else if (ctx.children.length > 1) {\n args = [];\n } else {\n args = null;\n }\n\n return {\n name: toText(ctx.identifier()),\n arguments: args\n };\n },\n ElementaryTypeNameExpression: function ElementaryTypeNameExpression(ctx) {\n return {\n typeName: this.visit(ctx.elementaryTypeName())\n };\n },\n TypeName: function TypeName(ctx) {\n if (ctx.children.length > 2) {\n var length = null;\n if (ctx.children.length === 4) {\n length = this.visit(ctx.getChild(2));\n }\n\n return {\n type: 'ArrayTypeName',\n baseTypeName: this.visit(ctx.getChild(0)),\n length: length\n };\n }\n if (ctx.children.length === 2) {\n return {\n type: 'ElementaryTypeName',\n name: toText(ctx.getChild(0)),\n stateMutability: toText(ctx.getChild(1))\n };\n }\n return this.visit(ctx.getChild(0));\n },\n FunctionTypeName: function FunctionTypeName(ctx) {\n var _this3 = this;\n\n var parameterTypes = ctx.functionTypeParameterList(0).functionTypeParameter().map(function (typeCtx) {\n return _this3.visit(typeCtx);\n });\n\n var returnTypes = [];\n if (ctx.functionTypeParameterList(1)) {\n returnTypes = ctx.functionTypeParameterList(1).functionTypeParameter().map(function (typeCtx) {\n return _this3.visit(typeCtx);\n });\n }\n\n var visibility = 'default';\n if (ctx.InternalKeyword(0)) {\n visibility = 'internal';\n } else if (ctx.ExternalKeyword(0)) {\n visibility = 'external';\n }\n\n var stateMutability = null;\n if (ctx.stateMutability(0)) {\n stateMutability = toText(ctx.stateMutability(0));\n }\n\n return {\n parameterTypes: parameterTypes,\n returnTypes: returnTypes,\n visibility: visibility,\n stateMutability: stateMutability\n };\n },\n ReturnStatement: function ReturnStatement(ctx) {\n var expression = null;\n if (ctx.expression()) {\n expression = this.visit(ctx.expression());\n }\n\n return { expression: expression };\n },\n EmitStatement: function EmitStatement(ctx) {\n return {\n eventCall: this.visit(ctx.functionCall())\n };\n },\n FunctionCall: function FunctionCall(ctx) {\n var _this4 = this;\n\n var args = [];\n var names = [];\n\n var ctxArgs = ctx.functionCallArguments();\n if (ctxArgs.expressionList()) {\n args = ctxArgs.expressionList().expression().map(function (exprCtx) {\n return _this4.visit(exprCtx);\n });\n } else if (ctxArgs.nameValueList()) {\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = ctxArgs.nameValueList().nameValue()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var nameValue = _step2.value;\n\n args.push(this.visit(nameValue.expression()));\n names.push(toText(nameValue.identifier()));\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n }\n\n return {\n expression: this.visit(ctx.expression()),\n arguments: args,\n names: names\n };\n },\n StructDefinition: function StructDefinition(ctx) {\n return {\n name: toText(ctx.identifier()),\n members: this.visit(ctx.variableDeclaration())\n };\n },\n VariableDeclaration: function VariableDeclaration(ctx) {\n var storageLocation = null;\n if (ctx.storageLocation()) {\n storageLocation = toText(ctx.storageLocation());\n }\n\n return {\n typeName: this.visit(ctx.typeName()),\n name: toText(ctx.identifier()),\n storageLocation: storageLocation,\n isStateVar: false,\n isIndexed: false\n };\n },\n EventParameter: function EventParameter(ctx) {\n var storageLocation = null;\n if (ctx.storageLocation(0)) {\n storageLocation = toText(ctx.storageLocation(0));\n }\n\n return {\n type: 'VariableDeclaration',\n typeName: this.visit(ctx.typeName()),\n name: toText(ctx.identifier()),\n storageLocation: storageLocation,\n isStateVar: false,\n isIndexed: !!ctx.IndexedKeyword(0)\n };\n },\n FunctionTypeParameter: function FunctionTypeParameter(ctx) {\n var storageLocation = null;\n if (ctx.storageLocation()) {\n storageLocation = toText(ctx.storageLocation());\n }\n\n return {\n type: 'VariableDeclaration',\n typeName: this.visit(ctx.typeName()),\n name: null,\n storageLocation: storageLocation,\n isStateVar: false,\n isIndexed: false\n };\n },\n WhileStatement: function WhileStatement(ctx) {\n return {\n condition: this.visit(ctx.expression()),\n body: this.visit(ctx.statement())\n };\n },\n DoWhileStatement: function DoWhileStatement(ctx) {\n return {\n condition: this.visit(ctx.expression()),\n body: this.visit(ctx.statement())\n };\n },\n IfStatement: function IfStatement(ctx) {\n var trueBody = this.visit(ctx.statement(0));\n\n var falseBody = null;\n if (ctx.statement().length > 1) {\n falseBody = this.visit(ctx.statement(1));\n }\n\n return {\n condition: this.visit(ctx.expression()),\n trueBody: trueBody,\n falseBody: falseBody\n };\n },\n UserDefinedTypeName: function UserDefinedTypeName(ctx) {\n return {\n namePath: toText(ctx)\n };\n },\n ElementaryTypeName: function ElementaryTypeName(ctx) {\n return {\n name: toText(ctx)\n };\n },\n Block: function Block(ctx) {\n return {\n statements: this.visit(ctx.statement())\n };\n },\n ExpressionStatement: function ExpressionStatement(ctx) {\n return {\n expression: this.visit(ctx.expression())\n };\n },\n NumberLiteral: function NumberLiteral(ctx) {\n var number = toText(ctx.getChild(0));\n var subdenomination = null;\n\n if (ctx.children.length === 2) {\n subdenomination = toText(ctx.getChild(1));\n }\n\n return {\n number: number,\n subdenomination: subdenomination\n };\n },\n Mapping: function Mapping(ctx) {\n return {\n keyType: this.visit(ctx.elementaryTypeName()),\n valueType: this.visit(ctx.typeName())\n };\n },\n ModifierDefinition: function ModifierDefinition(ctx) {\n var parameters = null;\n if (ctx.parameterList()) {\n parameters = this.visit(ctx.parameterList());\n }\n\n return {\n name: toText(ctx.identifier()),\n parameters: parameters,\n body: this.visit(ctx.block())\n };\n },\n Statement: function Statement(ctx) {\n return this.visit(ctx.getChild(0));\n },\n SimpleStatement: function SimpleStatement(ctx) {\n return this.visit(ctx.getChild(0));\n },\n Expression: function Expression(ctx) {\n var _this5 = this;\n\n var op = void 0;\n\n switch (ctx.children.length) {\n case 1:\n // primary expression\n return this.visit(ctx.getChild(0));\n\n case 2:\n op = toText(ctx.getChild(0));\n\n // new expression\n if (op === 'new') {\n return {\n type: 'NewExpression',\n typeName: this.visit(ctx.typeName())\n };\n }\n\n // prefix operators\n if (['+', '-', '++', '--', '!', '~', 'after', 'delete'].includes(op)) {\n return {\n type: 'UnaryOperation',\n operator: op,\n subExpression: this.visit(ctx.getChild(1)),\n isPrefix: true\n };\n }\n\n op = toText(ctx.getChild(1));\n\n // postfix operators\n if (['++', '--'].includes(op)) {\n return {\n type: 'UnaryOperation',\n operator: op,\n subExpression: this.visit(ctx.getChild(0)),\n isPrefix: false\n };\n }\n break;\n\n case 3:\n // treat parenthesis as no-op\n if (toText(ctx.getChild(0)) === '(' && toText(ctx.getChild(2)) === ')') {\n return {\n type: 'TupleExpression',\n components: [this.visit(ctx.getChild(1))],\n isArray: false\n };\n }\n\n op = toText(ctx.getChild(1));\n\n // tuple separator\n if (op === ',') {\n return {\n type: 'TupleExpression',\n components: [this.visit(ctx.getChild(0)), this.visit(ctx.getChild(2))],\n isArray: false\n };\n }\n\n // member access\n if (op === '.') {\n return {\n type: 'MemberAccess',\n expression: this.visit(ctx.getChild(0)),\n memberName: toText(ctx.getChild(2))\n };\n }\n\n if (isBinOp(op)) {\n return {\n type: 'BinaryOperation',\n operator: op,\n left: this.visit(ctx.getChild(0)),\n right: this.visit(ctx.getChild(2))\n };\n }\n break;\n\n case 4:\n // function call\n if (toText(ctx.getChild(1)) === '(' && toText(ctx.getChild(3)) === ')') {\n var args = [];\n var names = [];\n\n var ctxArgs = ctx.functionCallArguments();\n if (ctxArgs.expressionList()) {\n args = ctxArgs.expressionList().expression().map(function (exprCtx) {\n return _this5.visit(exprCtx);\n });\n } else if (ctxArgs.nameValueList()) {\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = ctxArgs.nameValueList().nameValue()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var nameValue = _step3.value;\n\n args.push(this.visit(nameValue.expression()));\n names.push(toText(nameValue.identifier()));\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n }\n\n return {\n type: 'FunctionCall',\n expression: this.visit(ctx.getChild(0)),\n arguments: args,\n names: names\n };\n }\n\n // index access\n if (toText(ctx.getChild(1)) === '[' && toText(ctx.getChild(3)) === ']') {\n return {\n type: 'IndexAccess',\n base: this.visit(ctx.getChild(0)),\n index: this.visit(ctx.getChild(2))\n };\n }\n break;\n\n case 5:\n // ternary operator\n if (toText(ctx.getChild(1)) === '?' && toText(ctx.getChild(3)) === ':') {\n return {\n type: 'Conditional',\n condition: this.visit(ctx.getChild(0)),\n trueExpression: this.visit(ctx.getChild(2)),\n falseExpression: this.visit(ctx.getChild(4))\n };\n }\n break;\n }\n\n throw new Error('unrecognized expression');\n },\n StateVariableDeclaration: function StateVariableDeclaration(ctx) {\n var type = this.visit(ctx.typeName());\n var iden = ctx.identifier();\n var name = toText(iden);\n\n var expression = null;\n if (ctx.expression()) {\n expression = this.visit(ctx.expression());\n }\n\n var visibility = 'default';\n if (ctx.InternalKeyword(0)) {\n visibility = 'internal';\n } else if (ctx.PublicKeyword(0)) {\n visibility = 'public';\n } else if (ctx.PrivateKeyword(0)) {\n visibility = 'private';\n }\n\n var isDeclaredConst = false;\n if (ctx.ConstantKeyword(0)) {\n isDeclaredConst = true;\n }\n\n var decl = this.createNode({\n type: 'VariableDeclaration',\n typeName: type,\n name: name,\n expression: expression,\n visibility: visibility,\n isStateVar: true,\n isDeclaredConst: isDeclaredConst,\n isIndexed: false\n }, iden);\n\n return {\n variables: [decl],\n initialValue: expression\n };\n },\n ForStatement: function ForStatement(ctx) {\n var conditionExpression = this.visit(ctx.expressionStatement());\n if (conditionExpression) {\n conditionExpression = conditionExpression.expression;\n }\n return {\n initExpression: this.visit(ctx.simpleStatement()),\n conditionExpression: conditionExpression,\n loopExpression: {\n type: 'ExpressionStatement',\n expression: this.visit(ctx.expression())\n },\n body: this.visit(ctx.statement())\n };\n },\n PrimaryExpression: function PrimaryExpression(ctx) {\n if (ctx.BooleanLiteral()) {\n return {\n type: 'BooleanLiteral',\n value: toText(ctx.BooleanLiteral()) === 'true'\n };\n }\n\n if (ctx.HexLiteral()) {\n return {\n type: 'HexLiteral',\n value: toText(ctx.HexLiteral())\n };\n }\n\n if (ctx.StringLiteral()) {\n var text = toText(ctx);\n var singleQuotes = text[0] === \"'\";\n var textWithoutQuotes = text.substring(1, text.length - 1);\n var value = singleQuotes ? textWithoutQuotes.replace(new RegExp(\"\\\\\\\\'\", 'g'), \"'\") : textWithoutQuotes.replace(new RegExp('\\\\\\\\\"', 'g'), '\"');\n return {\n type: 'StringLiteral',\n value: value\n };\n }\n\n if (ctx.TypeKeyword()) {\n return {\n type: 'Identifier',\n name: 'type'\n };\n }\n\n if (ctx.children.length == 3 && toText(ctx.getChild(1)) === '[' && toText(ctx.getChild(2)) === ']') {\n var node = this.visit(ctx.getChild(0));\n if (node.type === 'Identifier') {\n node = {\n type: 'UserDefinedTypeName',\n namePath: node.name\n };\n } else {\n node = {\n type: 'ElementaryTypeName',\n name: toText(ctx.getChild(0))\n };\n }\n return {\n type: 'ArrayTypeName',\n baseTypeName: node,\n length: null\n };\n }\n\n return this.visit(ctx.getChild(0));\n },\n Identifier: function Identifier(ctx) {\n return {\n name: toText(ctx)\n };\n },\n TupleExpression: function TupleExpression(ctx) {\n var _this6 = this;\n\n // remove parentheses\n var children = ctx.children.slice(1, -1);\n var components = mapCommasToNulls(children).map(function (expr) {\n // add a null for each empty value\n if (expr === null) {\n return null;\n }\n return _this6.visit(expr);\n });\n\n return {\n components: components,\n isArray: toText(ctx.getChild(0)) === '['\n };\n },\n IdentifierList: function IdentifierList(ctx) {\n var _this7 = this;\n\n // remove parentheses\n var children = ctx.children.slice(1, -1);\n return mapCommasToNulls(children).map(function (iden) {\n // add a null for each empty value\n if (iden === null) {\n return null;\n }\n\n return _this7.createNode({\n type: 'VariableDeclaration',\n name: toText(iden),\n storageLocation: null,\n typeName: null,\n isStateVar: false,\n isIndexed: false\n }, iden);\n });\n },\n VariableDeclarationList: function VariableDeclarationList(ctx) {\n var _this8 = this;\n\n // remove parentheses\n return mapCommasToNulls(ctx.children).map(function (decl) {\n // add a null for each empty value\n if (decl === null) {\n return null;\n }\n\n var storageLocation = null;\n if (decl.storageLocation()) {\n storageLocation = toText(decl.storageLocation());\n }\n\n return _this8.createNode({\n type: 'VariableDeclaration',\n name: toText(decl.identifier()),\n typeName: _this8.visit(decl.typeName()),\n storageLocation: storageLocation,\n isStateVar: false,\n isIndexed: false\n }, decl);\n });\n },\n VariableDeclarationStatement: function VariableDeclarationStatement(ctx) {\n var variables = void 0;\n if (ctx.variableDeclaration()) {\n variables = [this.visit(ctx.variableDeclaration())];\n } else if (ctx.identifierList()) {\n variables = this.visit(ctx.identifierList());\n } else if (ctx.variableDeclarationList()) {\n variables = this.visit(ctx.variableDeclarationList());\n }\n\n var initialValue = null;\n if (ctx.expression()) {\n initialValue = this.visit(ctx.expression());\n }\n\n return {\n variables: variables,\n initialValue: initialValue\n };\n },\n ImportDirective: function ImportDirective(ctx) {\n var pathString = toText(ctx.StringLiteral());\n var unitAlias = null;\n var symbolAliases = null;\n\n if (ctx.importDeclaration().length > 0) {\n symbolAliases = ctx.importDeclaration().map(function (decl) {\n var symbol = toText(decl.identifier(0));\n var alias = null;\n if (decl.identifier(1)) {\n alias = toText(decl.identifier(1));\n }\n return [symbol, alias];\n });\n } else if (ctx.children.length === 7) {\n unitAlias = toText(ctx.getChild(3));\n } else if (ctx.children.length === 5) {\n unitAlias = toText(ctx.getChild(3));\n }\n\n return {\n path: pathString.substring(1, pathString.length - 1),\n unitAlias: unitAlias,\n symbolAliases: symbolAliases\n };\n },\n EventDefinition: function EventDefinition(ctx) {\n return {\n name: toText(ctx.identifier()),\n parameters: this.visit(ctx.eventParameterList()),\n isAnonymous: !!ctx.AnonymousKeyword()\n };\n },\n EventParameterList: function EventParameterList(ctx) {\n return ctx.eventParameter().map(function (paramCtx) {\n var type = this.visit(paramCtx.typeName());\n var name = null;\n if (paramCtx.identifier()) {\n name = toText(paramCtx.identifier());\n }\n\n return this.createNode({\n type: 'VariableDeclaration',\n typeName: type,\n name: name,\n isStateVar: false,\n isIndexed: !!paramCtx.IndexedKeyword(0)\n }, paramCtx);\n }, this);\n },\n ReturnParameters: function ReturnParameters(ctx) {\n return this.visit(ctx.parameterList());\n },\n ParameterList: function ParameterList(ctx) {\n var _this9 = this;\n\n return ctx.parameter().map(function (paramCtx) {\n return _this9.visit(paramCtx);\n });\n },\n Parameter: function Parameter(ctx) {\n var storageLocation = null;\n if (ctx.storageLocation()) {\n storageLocation = toText(ctx.storageLocation());\n }\n\n var name = null;\n if (ctx.identifier()) {\n name = toText(ctx.identifier());\n }\n\n return {\n type: 'VariableDeclaration',\n typeName: this.visit(ctx.typeName()),\n name: name,\n storageLocation: storageLocation,\n isStateVar: false,\n isIndexed: false\n };\n },\n InlineAssemblyStatement: function InlineAssemblyStatement(ctx) {\n var language = null;\n if (ctx.StringLiteral()) {\n language = toText(ctx.StringLiteral());\n language = language.substring(1, language.length - 1);\n }\n\n return {\n language: language,\n body: this.visit(ctx.assemblyBlock())\n };\n },\n AssemblyBlock: function AssemblyBlock(ctx) {\n var _this10 = this;\n\n var operations = ctx.assemblyItem().map(function (it) {\n return _this10.visit(it);\n });\n\n return { operations: operations };\n },\n AssemblyItem: function AssemblyItem(ctx) {\n var text = void 0;\n\n if (ctx.HexLiteral()) {\n return {\n type: 'HexLiteral',\n value: toText(ctx.HexLiteral())\n };\n }\n\n if (ctx.StringLiteral()) {\n text = toText(ctx.StringLiteral());\n return {\n type: 'StringLiteral',\n value: text.substring(1, text.length - 1)\n };\n }\n\n if (ctx.BreakKeyword()) {\n return {\n type: 'Break'\n };\n }\n\n if (ctx.ContinueKeyword()) {\n return {\n type: 'Continue'\n };\n }\n\n return this.visit(ctx.getChild(0));\n },\n AssemblyExpression: function AssemblyExpression(ctx) {\n return this.visit(ctx.getChild(0));\n },\n AssemblyCall: function AssemblyCall(ctx) {\n var _this11 = this;\n\n var functionName = toText(ctx.getChild(0));\n var args = ctx.assemblyExpression().map(function (arg) {\n return _this11.visit(arg);\n });\n\n return {\n functionName: functionName,\n arguments: args\n };\n },\n AssemblyLiteral: function AssemblyLiteral(ctx) {\n var text = void 0;\n\n if (ctx.StringLiteral()) {\n text = toText(ctx);\n return {\n type: 'StringLiteral',\n value: text.substring(1, text.length - 1)\n };\n }\n\n if (ctx.DecimalNumber()) {\n return {\n type: 'DecimalNumber',\n value: toText(ctx)\n };\n }\n\n if (ctx.HexNumber()) {\n return {\n type: 'HexNumber',\n value: toText(ctx)\n };\n }\n\n if (ctx.HexLiteral()) {\n return {\n type: 'HexLiteral',\n value: toText(ctx)\n };\n }\n },\n AssemblySwitch: function AssemblySwitch(ctx) {\n var _this12 = this;\n\n return {\n expression: this.visit(ctx.assemblyExpression()),\n cases: ctx.assemblyCase().map(function (c) {\n return _this12.visit(c);\n })\n };\n },\n AssemblyCase: function AssemblyCase(ctx) {\n var value = null;\n if (toText(ctx.getChild(0)) === 'case') {\n value = this.visit(ctx.assemblyLiteral());\n }\n\n var node = { block: this.visit(ctx.assemblyBlock()) };\n if (value !== null) {\n node.value = value;\n } else {\n node.default = true;\n }\n\n return node;\n },\n AssemblyLocalDefinition: function AssemblyLocalDefinition(ctx) {\n var names = ctx.assemblyIdentifierOrList();\n if (names.identifier()) {\n names = [this.visit(names.identifier())];\n } else {\n names = this.visit(names.assemblyIdentifierList().identifier());\n }\n\n return {\n names: names,\n expression: this.visit(ctx.assemblyExpression())\n };\n },\n AssemblyFunctionDefinition: function AssemblyFunctionDefinition(ctx) {\n var args = ctx.assemblyIdentifierList();\n args = args ? this.visit(args.identifier()) : [];\n\n var returnArgs = ctx.assemblyFunctionReturns();\n returnArgs = returnArgs ? this.visit(returnArgs.assemblyIdentifierList().identifier()) : [];\n\n return {\n name: toText(ctx.identifier()),\n arguments: args,\n returnArguments: returnArgs,\n body: this.visit(ctx.assemblyBlock())\n };\n },\n AssemblyAssignment: function AssemblyAssignment(ctx) {\n var names = ctx.assemblyIdentifierOrList();\n if (names.identifier()) {\n names = [this.visit(names.identifier())];\n } else {\n names = this.visit(names.assemblyIdentifierList().identifier());\n }\n\n return {\n names: names,\n expression: this.visit(ctx.assemblyExpression())\n };\n },\n LabelDefinition: function LabelDefinition(ctx) {\n return {\n name: toText(ctx.identifier())\n };\n },\n AssemblyStackAssignment: function AssemblyStackAssignment(ctx) {\n return {\n name: toText(ctx.identifier())\n };\n },\n AssemblyFor: function AssemblyFor(ctx) {\n return {\n pre: this.visit(ctx.getChild(1)),\n condition: this.visit(ctx.getChild(2)),\n post: this.visit(ctx.getChild(3)),\n body: this.visit(ctx.getChild(4))\n };\n },\n AssemblyIf: function AssemblyIf(ctx) {\n return {\n condition: this.visit(ctx.assemblyExpression()),\n body: this.visit(ctx.assemblyBlock())\n };\n }\n};\n\nfunction ASTBuilder(options) {\n antlr4.tree.ParseTreeVisitor.call(this);\n this.options = options;\n}\n\nASTBuilder.prototype = Object.create(antlr4.tree.ParseTreeVisitor.prototype);\nASTBuilder.prototype.constructor = ASTBuilder;\n\nASTBuilder.prototype._loc = function (ctx) {\n var sourceLocation = {\n start: {\n line: ctx.start.line,\n column: ctx.start.column\n },\n end: {\n line: ctx.stop.line,\n column: ctx.stop.column\n }\n };\n return { loc: sourceLocation };\n};\n\nASTBuilder.prototype._range = function (ctx) {\n return { range: [ctx.start.start, ctx.stop.stop] };\n};\n\nASTBuilder.prototype.meta = function (ctx) {\n var ret = {};\n if (this.options.loc) {\n Object.assign(ret, this._loc(ctx));\n }\n if (this.options.range) {\n Object.assign(ret, this._range(ctx));\n }\n return ret;\n};\n\nASTBuilder.prototype.createNode = function (obj, ctx) {\n return Object.assign(obj, this.meta(ctx));\n};\n\nASTBuilder.prototype.visit = function (ctx) {\n if (ctx == null) {\n return null;\n }\n\n if (Array.isArray(ctx)) {\n return ctx.map(function (child) {\n return this.visit(child);\n }, this);\n }\n\n var name = ctx.constructor.name;\n if (name.endsWith('Context')) {\n name = name.substring(0, name.length - 'Context'.length);\n }\n\n var node = { type: name };\n\n if (name in transformAST) {\n var visited = transformAST[name].call(this, ctx);\n if (Array.isArray(visited)) {\n return visited;\n }\n Object.assign(node, visited);\n }\n\n return this.createNode(node, ctx);\n};\n\nmodule.exports = ASTBuilder;\n\n//# sourceURL=webpack:///./node_modules/solidity-parser-antlr/dist/ASTBuilder.js?")},"./node_modules/solidity-parser-antlr/dist/ErrorListener.js":function(module,exports,__webpack_require__){"use strict";eval('\n\nvar antlr4 = __webpack_require__("./node_modules/solidity-parser-antlr/dist/antlr4/index.js");\n\nfunction ErrorListener() {\n antlr4.error.ErrorListener.call(this);\n this._errors = [];\n}\n\nErrorListener.prototype = Object.create(antlr4.error.ErrorListener.prototype);\nErrorListener.prototype.constructor = ErrorListener;\n\nErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, message) {\n this._errors.push({ message: message, line: line, column: column });\n};\n\nErrorListener.prototype.getErrors = function () {\n return this._errors;\n};\n\nErrorListener.prototype.hasErrors = function () {\n return this._errors.length > 0;\n};\n\nmodule.exports = ErrorListener;\n\n//# sourceURL=webpack:///./node_modules/solidity-parser-antlr/dist/ErrorListener.js?')},"./node_modules/solidity-parser-antlr/dist/antlr4/BufferedTokenStream.js":function(module,exports,__webpack_require__){"use strict";eval('\n\n//\n/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.\n * Use of this file is governed by the BSD 3-clause license that\n * can be found in the LICENSE.txt file in the project root.\n */\n\n// This implementation of {@link TokenStream} loads tokens from a\n// {@link TokenSource} on-demand, and places the tokens in a buffer to provide\n// access to any previous token by index.\n//\n// <p>\n// This token stream ignores the value of {@link Token//getChannel}. If your\n// parser requires the token stream filter tokens to only those on a particular\n// channel, such as {@link Token//DEFAULT_CHANNEL} or\n// {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a\n// {@link CommonTokenStream}.</p>\n\nvar Token = __webpack_require__("./node_modules/solidity-parser-antlr/dist/antlr4/Token.js").Token;\nvar Lexer = __webpack_require__("./node_modules/solidity-parser-antlr/dist/antlr4/Lexer.js").Lexer;\nvar Interval = __webpack_require__("./node_modules/solidity-parser-antlr/dist/antlr4/IntervalSet.js").Interval;\n\n// this is just to keep meaningful parameter types to Parser\nfunction TokenStream() {\n\treturn this;\n}\n\nfunction BufferedTokenStream(tokenSource) {\n\n\tTokenStream.call(this);\n\t// The {@link TokenSource} from which tokens for this stream are fetched.