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

include variables from outer scopes#271

Merged
ofrobots merged 2 commits intogoogleapis:masterfrom
ofrobots:ts-vars
Jun 7, 2017
Merged

include variables from outer scopes#271
ofrobots merged 2 commits intogoogleapis:masterfrom
ofrobots:ts-vars

Conversation

@ofrobots
Copy link
Copy Markdown
Contributor

@ofrobots ofrobots commented Jun 6, 2017

We were previously omitting variables from closure scopes. This can be
problematic specifically in transpiled async functions as most actual
variables end up in a closure.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 6, 2017
assert(allScopes[count - 2].scopeType() == ScopeType.Script);

// We find the top-level (module global) variable pollute the local variables
// we we omit them by default, unless the breakpoint itself is top-level. The

This comment was marked as spam.

This comment was marked as spam.

process.nextTick(run);
api.wait(bp, (err) => {
assert.ifError(err);
// console.log(require('util').inspect(bp.stackFrames, {depth: null}));

This comment was marked as spam.

This comment was marked as spam.

// There will always be at least 3 scopes.
// For top-level breakpoints: [local, script, global]
// Other: [..., closure (module IIFE), script, global]
assert(count >= 3);

This comment was marked as spam.

This comment was marked as spam.

// Other: [..., closure (module IIFE), script, global]
assert(count >= 3);
assert(allScopes[count - 1].scopeType() == ScopeType.Global);
assert(allScopes[count - 2].scopeType() == ScopeType.Script);

This comment was marked as spam.

This comment was marked as spam.

We were previously omitting variables from closure scopes. This can be
problematic specifically in transpiled async functions as most actual
variables end up in a closure.
Copy link
Copy Markdown
Contributor

@matthewloring matthewloring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nit

const run = require('./fixtures/ts/async.js');
api.set(bp, (err) => {
assert.ifError(err);
process.nextTick(run);

This comment was marked as spam.

This comment was marked as spam.

@ofrobots ofrobots merged commit 37d7745 into googleapis:master Jun 7, 2017
@ofrobots ofrobots deleted the ts-vars branch June 7, 2017 02:23
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.

3 participants