-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New pencil tracer without variable tracking.
- Loading branch information
Showing
2 changed files
with
79 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,28 +122,38 @@ | |
switch (eventType) { | ||
case "before": | ||
case "after": | ||
funcDef = this.isFunctionDef(options.node) ? ", functionDef: true" : ""; | ||
return "vars: [" + ((function() { | ||
var j, len, results; | ||
results = []; | ||
for (j = 0, len = vars.length; j < len; j++) { | ||
name = vars[j]; | ||
results.push("{name: '" + name + "', value: " + (this.soakify(name)) + " " + funcDef + "}"); | ||
} | ||
return results; | ||
}).call(this)) + "]"; | ||
if (this.options.trackVariables) { | ||
funcDef = this.isFunctionDef(options.node) ? ", functionDef: true" : ""; | ||
return ", vars: [" + ((function() { | ||
var j, len, results; | ||
results = []; | ||
for (j = 0, len = vars.length; j < len; j++) { | ||
name = vars[j]; | ||
results.push("{name: '" + name + "', value: " + (this.soakify(name)) + " " + funcDef + "}"); | ||
} | ||
return results; | ||
}).call(this)) + "]"; | ||
} else { | ||
return ""; | ||
} | ||
break; | ||
case "enter": | ||
return "vars: [" + ((function() { | ||
var j, len, results; | ||
results = []; | ||
for (j = 0, len = vars.length; j < len; j++) { | ||
name = vars[j]; | ||
results.push("{name: '" + name + "', value: " + name + "}"); | ||
} | ||
return results; | ||
})()) + "]"; | ||
if (this.options.trackVariables) { | ||
return ", vars: [" + ((function() { | ||
var j, len, results; | ||
results = []; | ||
for (j = 0, len = vars.length; j < len; j++) { | ||
name = vars[j]; | ||
results.push("{name: '" + name + "', value: " + name + "}"); | ||
} | ||
return results; | ||
})()) + "]"; | ||
} else { | ||
return ""; | ||
} | ||
break; | ||
case "leave": | ||
return "returnOrThrow: " + options.returnOrThrowVar; | ||
return ", returnOrThrow: " + options.returnOrThrowVar; | ||
} | ||
}).call(this); | ||
if (eventType === "after") { | ||
|
@@ -169,7 +179,7 @@ | |
})()) + "]"; | ||
} | ||
} | ||
eventObj = "{ location: " + locationObj + ", type: '" + eventType + "', " + extra + " }"; | ||
eventObj = "{ location: " + locationObj + ", type: '" + eventType + "'" + extra + " }"; | ||
instrumentedNode = this.coffee.nodes(this.options.traceFunc + "(" + eventObj + ")").expressions[0]; | ||
instrumentedNode.pencilTracerInstrumented = true; | ||
return instrumentedNode; | ||
|
@@ -749,7 +759,7 @@ | |
JavaScriptInstrumenter = (function() { | ||
function JavaScriptInstrumenter(options1) { | ||
var base1; | ||
this.options = options1; | ||
this.options = options1 != null ? options1 : {}; | ||
if ((base1 = this.options).traceFunc == null) { | ||
base1.traceFunc = "pencilTrace"; | ||
} | ||
|
@@ -824,28 +834,38 @@ | |
switch (eventType) { | ||
case "before": | ||
case "after": | ||
funcDef = this.isFunctionDef(options.node) ? ", functionDef: true" : ""; | ||
return "vars: [" + ((function() { | ||
var j, len, results; | ||
results = []; | ||
for (j = 0, len = vars.length; j < len; j++) { | ||
name = vars[j]; | ||
results.push("{name: '" + name + "', value: " + (this.soakify(name)) + " " + funcDef + "}"); | ||
} | ||
return results; | ||
}).call(this)) + "]"; | ||
if (this.options.trackVariables) { | ||
funcDef = this.isFunctionDef(options.node) ? ", functionDef: true" : ""; | ||
return ", vars: [" + ((function() { | ||
var j, len, results; | ||
results = []; | ||
for (j = 0, len = vars.length; j < len; j++) { | ||
name = vars[j]; | ||
results.push("{name: '" + name + "', value: " + (this.soakify(name)) + " " + funcDef + "}"); | ||
} | ||
return results; | ||
}).call(this)) + "]"; | ||
} else { | ||
return ""; | ||
} | ||
break; | ||
case "enter": | ||
return "vars: [" + ((function() { | ||
var j, len, results; | ||
results = []; | ||
for (j = 0, len = vars.length; j < len; j++) { | ||
name = vars[j]; | ||
results.push("{name: '" + name + "', value: " + name + "}"); | ||
} | ||
return results; | ||
})()) + "]"; | ||
if (this.options.trackVariables) { | ||
return ", vars: [" + ((function() { | ||
var j, len, results; | ||
results = []; | ||
for (j = 0, len = vars.length; j < len; j++) { | ||
name = vars[j]; | ||
results.push("{name: '" + name + "', value: " + name + "}"); | ||
} | ||
return results; | ||
})()) + "]"; | ||
} else { | ||
return ""; | ||
} | ||
break; | ||
case "leave": | ||
return "returnOrThrow: " + options.returnOrThrowVar; | ||
return ", returnOrThrow: " + options.returnOrThrowVar; | ||
} | ||
}).call(this); | ||
if (eventType === "after") { | ||
|
@@ -871,7 +891,7 @@ | |
})()) + "]"; | ||
} | ||
} | ||
eventObj = "{ location: " + locationObj + ", type: '" + eventType + "', " + extra + " }"; | ||
eventObj = "{ location: " + locationObj + ", type: '" + eventType + "'" + extra + " }"; | ||
instrumentedNode = acorn.parse(this.options.traceFunc + "(" + eventObj + ");").body[0]; | ||
instrumentedNode.pencilTracerInstrumented = true; | ||
instrumentedNode.expression.pencilTracerInstrumented = true; | ||
|
@@ -11276,9 +11296,8 @@ module.exports={ | |
}, | ||
"maintainers": [ | ||
{ | ||
"name": "Yusuke Suzuki", | ||
"email": "[email protected]", | ||
"url": "http://github.com/Constellation" | ||
"name": "constellation", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"repository": { | ||
|
@@ -11321,15 +11340,25 @@ module.exports={ | |
"build-min": "cjsify -ma path: tools/entry-point.js > escodegen.browser.min.js", | ||
"build": "cjsify -a path: tools/entry-point.js > escodegen.browser.js" | ||
}, | ||
"readme": "## Escodegen\n[](http://badge.fury.io/js/escodegen)\n[](http://travis-ci.org/estools/escodegen)\n[](https://david-dm.org/estools/escodegen)\n[](https://david-dm.org/estools/escodegen#info=devDependencies)\n\nEscodegen ([escodegen](http://github.com/estools/escodegen)) is an\n[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)\n(also popularly known as [JavaScript](http://en.wikipedia.org/wiki/JavaScript))\ncode generator from [Mozilla's Parser API](https://developer.mozilla.org/en/SpiderMonkey/Parser_API)\nAST. See the [online generator](https://estools.github.io/escodegen/demo/index.html)\nfor a demo.\n\n\n### Install\n\nEscodegen can be used in a web browser:\n\n <script src=\"escodegen.browser.js\"></script>\n\nescodegen.browser.js can be found in tagged revisions on GitHub.\n\nOr in a Node.js application via npm:\n\n npm install escodegen\n\n### Usage\n\nA simple example: the program\n\n escodegen.generate({\n type: 'BinaryExpression',\n operator: '+',\n left: { type: 'Literal', value: 40 },\n right: { type: 'Literal', value: 2 }\n });\n\nproduces the string `'40 + 2'`.\n\nSee the [API page](https://github.com/estools/escodegen/wiki/API) for\noptions. To run the tests, execute `npm test` in the root directory.\n\n### Building browser bundle / minified browser bundle\n\nAt first, execute `npm install` to install the all dev dependencies.\nAfter that,\n\n npm run-script build\n\nwill generate `escodegen.browser.js`, which can be used in browser environments.\n\nAnd,\n\n npm run-script build-min\n\nwill generate the minified file `escodegen.browser.min.js`.\n\n### License\n\n#### Escodegen\n\nCopyright (C) 2012 [Yusuke Suzuki](http://github.com/Constellation)\n (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n#### source-map\n\nSourceNodeMocks has a limited interface of mozilla/source-map SourceNode implementations.\n\nCopyright (c) 2009-2011, Mozilla Foundation and contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the names of the Mozilla Foundation nor the names of project\n contributors may be used to endorse or promote products derived from this\n software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n", | ||
"readmeFilename": "README.md", | ||
"gitHead": "1ca664f68dcf220b76c9dc562b2337c5e0b4227d", | ||
"bugs": { | ||
"url": "https://github.com/estools/escodegen/issues" | ||
}, | ||
"_id": "[email protected]", | ||
"_shasum": "367de17d8510540d12bc6dcb8b3f918391265815", | ||
"_from": "escodegen@>=1.6.1 <2.0.0", | ||
"_npmVersion": "2.0.0-alpha-5", | ||
"_npmUser": { | ||
"name": "constellation", | ||
"email": "[email protected]" | ||
}, | ||
"dist": { | ||
"shasum": "367de17d8510540d12bc6dcb8b3f918391265815", | ||
"tarball": "http://registry.npmjs.org/escodegen/-/escodegen-1.6.1.tgz" | ||
}, | ||
"directories": {}, | ||
"_resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.6.1.tgz", | ||
"_from": "escodegen@>=1.6.1 <2.0.0" | ||
"readme": "ERROR: No README data found!" | ||
} | ||
|
||
},{}]},{},[2])(2) | ||
|