Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debugger: don't override module binding #572

Closed
wants to merge 1 commit into from

Conversation

vkurchatkin
Copy link
Contributor

Overriding module argument with const causes SyntaxError.

Apparently this is something you can't do:

'use strict'

function test(module) {
  const module = {}
}

test({})

P.S. make test-debugger hangs, someone has to look at it

R=@cjihrig

Overriding `module` argument with `const` causes
`SyntaxError`.
@@ -4,8 +4,8 @@ const util = require('util');
const path = require('path');
const net = require('net');
const vm = require('vm');
const module = require('module');
const repl = module.requireRepl();
const Module = require('module');
Copy link
Contributor

Choose a reason for hiding this comment

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

@bnoordhuis are you OK with the capitalization? If not, we could replace the two following instances with require('module'), use a different name, or switch from const. Any preference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Module is a constructor so it makes sense. It's exactly how it's called in lib/module.js

Copy link
Contributor

Choose a reason for hiding this comment

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

@vkurchatkin you're right. It's used that way in other places too.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 23, 2015

LGTM

@Fishrock123
Copy link
Contributor

And this worked with var? That's interesting...

cjihrig pushed a commit that referenced this pull request Jan 23, 2015
Overriding module argument with const causes a SyntaxError. This
commit changes the variable name to remove the error.

PR-URL: #572
Reviewed-By: Colin Ihrig <[email protected]>
@cjihrig
Copy link
Contributor

cjihrig commented Jan 23, 2015

Thanks @vkurchatkin! Landed in f4c536b

@cjihrig cjihrig closed this Jan 23, 2015
@cjihrig
Copy link
Contributor

cjihrig commented Jan 23, 2015

@Fishrock123 yea, I believe the problem is that a const has to be unique in the scope it is defined in.

@vkurchatkin
Copy link
Contributor Author

@Fishrock123 this same with let

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants