Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Add ScopeMirror traversal to state.js #142

Merged

Conversation

cristiancavalli
Copy link
Contributor

Replace the FrameMirror.localValue code path with ScopeMirror
traversal and rewrite the arguments collector to only serialize
arguments which are not matched by name with a more deeply-scoped
value.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 25, 2016
@cristiancavalli
Copy link
Contributor Author

@matthewloring @ofrobots PTAL

@cristiancavalli
Copy link
Contributor Author

@ofrobots @matthewloring CI is now green and ready for another look

@matthewloring
Copy link
Contributor

Could this PR include tests for the case where nested variables have the same name? Also, is this the change that resolves error objects defined in catch blocks?

@cristiancavalli
Copy link
Contributor Author

@matthewloring updated

@matthewloring
Copy link
Contributor

Let's look into the 0.12/4.0 behavioral difference from the failing test.

@cristiancavalli cristiancavalli force-pushed the use_scope_mirrors branch 4 times, most recently from b8dad03 to 065a8f8 Compare August 3, 2016 21:28
@@ -587,8 +601,13 @@ describe('v8debugapi', function() {

var topFrame = bp.stackFrames[0];
assert.equal(topFrame['function'], 'foo');
assert.equal(topFrame.arguments[0].name, 'n');
assert.equal(topFrame.arguments[0].value, '3');
if (semver.satisfies(process.version, '<1.6')) {

This comment was marked as spam.

@cristiancavalli
Copy link
Contributor Author

@ofrobots @matthewloring any traction on this?

/*4*/ var a = 10;
/*5*/ a += 1;
/*6*/ return (function (b) {
/*7*/ var a = 10;

This comment was marked as spam.

@matthewloring
Copy link
Contributor

LGTM w/ nit on my end. We should have ofrobots@ take a look at the version dependencies introduced in the tests.

varTableIndex: ARG_LOCAL_LIMIT_MESSAGE_INDEX
}];
} else {
args = [{

This comment was marked as spam.

@matthewloring
Copy link
Contributor

Could we add additional tests for each of the internal bugs addressed in this issue.

@cristiancavalli cristiancavalli force-pushed the use_scope_mirrors branch 2 times, most recently from c90c24f to 72e780d Compare August 12, 2016 20:02
@cristiancavalli
Copy link
Contributor Author

cristiancavalli commented Aug 12, 2016

@matthewloring @ofrobots Feedback integrated; looks like Travis is having troubles right now and the builds are just sitting there. Tested locally with Node.JS 0.12 and 6.3.1

@cristiancavalli
Copy link
Contributor Author

Not sure why v5 failed, passes locally on my machine and that test was not touched. Travis won't let me restart the build though.
screen shot 2016-08-12 at 2 30 48 pm

if (argMatch && (semver.satisfies(process.version, '<1.6'))) {
// If the version is lower than 1.6 we will use the frame's argument
// list to source argument values, yet the ScopeMirror traversal for
// node these Node versions will also return the arguments.

This comment was marked as spam.

This comment was marked as spam.

/*7*/ };
/*8*/ return a(1);
/*9*/}
/*10*/module.exports = foo;

This comment was marked as spam.

This comment was marked as spam.

@matthewloring
Copy link
Contributor

LGTM with a few nits. Let's get a final sign off from @ofrobots.

@cristiancavalli cristiancavalli force-pushed the use_scope_mirrors branch 2 times, most recently from 8c72049 to ea5fc89 Compare August 13, 2016 05:29
@cristiancavalli
Copy link
Contributor Author

@matthewloring @ofrobots Updated

@@ -0,0 +1,11 @@
/*1* KEEP THIS CODE AT THE TOP TO AVOID LINE NUMBER CHANGES */ /* jshint shadow:true */

This comment was marked as spam.

@ofrobots
Copy link
Contributor

lgtm once comments are addressed

@cristiancavalli cristiancavalli force-pushed the use_scope_mirrors branch 2 times, most recently from ea8d60d to 3fa14c6 Compare August 15, 2016 18:00
Replace the `FrameMirror.localValue` code path with `ScopeMirror`
traversal and rewrite the arguments collector to only serialize
arguments which are not matched by name with a more deeply-scoped
value. Add closure scope type to filter list because of confusion
with node.JS requires. Add tests for nested, confounding variable
names and try/catch.

03/08/2016-10:07 PST
Update to use locals only becuase of 0.12 behaviour.

12/08/2016-12:40 PST
Update with full-range of test-cases gathered from bug-bash. Add more
testing around locals for node versions less than 1.6. Add more
documentation around new ScopeMirror traversal. Add 'this' context
extraction and tests.

15/08/2016-10:54 PST
Respond to PR feedback
@cristiancavalli
Copy link
Contributor Author

@ofrobots @matthewloring Updated. I don't have the power to merge in though

@ofrobots
Copy link
Contributor

You have the power now.

@cristiancavalli cristiancavalli merged commit edcfb04 into googleapis:master Aug 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants