Skip to content

Instantly share code, notes, and snippets.

@twada

twada/output Secret

Created March 4, 2016 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twada/af515224d858426ff480 to your computer and use it in GitHub Desktop.
Save twada/af515224d858426ff480 to your computer and use it in GitHub Desktop.
BlockStatement:exit
onCodePathStart: s1
onCodePathSegmentStart: s1_1
onCodePathStart: s2
onCodePathSegmentStart: s2_1
BlockStatement:enter currentCodePath.currentSegments.length: 1 currentCodePath.currentSegments[0].id: s2_1
BlockStatement:enter currentSegment.id: s2_1
onCodePathSegmentEnd: s2_1
onCodePathSegmentStart: s2_2
BlockStatement:enter currentCodePath.currentSegments.length: 1 currentCodePath.currentSegments[0].id: s2_2
BlockStatement:enter currentSegment.id: s2_2
onCodePathSegmentEnd: s2_2
BlockStatement:exit currentCodePath.currentSegments.length: 1 currentCodePath.currentSegments[0].id: s2_3 <= !?
BlockStatement:exit currentSegment.id: null <= !?
onCodePathSegmentStart: s2_4
BlockStatement:exit currentCodePath.currentSegments.length: 1 currentCodePath.currentSegments[0].id: s2_4
BlockStatement:exit currentSegment.id: s2_4
onCodePathSegmentEnd: s2_4
onCodePathEnd: s2
onCodePathSegmentEnd: s1_1
onCodePathEnd: s1
module.exports = function(context) {
var currentCodePath = null;
var currentSegment = null;
return {
onCodePathStart: function(codePath, node) {
console.log('onCodePathStart: ' + codePath.id);
currentCodePath = codePath;
},
onCodePathEnd: function(codePath, node) {
console.log('onCodePathEnd: ' + codePath.id);
currentCodePath = currentCodePath.upper;
},
onCodePathSegmentStart: function(segment, node) {
console.log('onCodePathSegmentStart: ' + segment.id);
currentSegment = segment;
},
onCodePathSegmentEnd: function(segment, node) {
console.log('onCodePathSegmentEnd: ' + segment.id);
currentSegment = null;
},
BlockStatement: function () {
console.log('BlockStatement:enter currentCodePath.currentSegments.length: ' + currentCodePath.currentSegments.length + ' currentCodePath.currentSegments[0].id: ' + currentCodePath.currentSegments[0].id);
console.log('BlockStatement:enter currentSegment.id: ' + (currentSegment && currentSegment.id));
},
'BlockStatement:exit': function () {
console.log('BlockStatement:exit currentCodePath.currentSegments.length: ' + currentCodePath.currentSegments.length + ' currentCodePath.currentSegments[0].id: ' + currentCodePath.currentSegments[0].id);
console.log('BlockStatement:exit currentSegment.id: ' + (currentSegment && currentSegment.id));
}
};
};
foo((done) => {
if (bar()) {
return done();
}
baz();
done();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment