Skip to content

Conversation

@sokra
Copy link
Contributor

@sokra sokra commented Mar 17, 2013

see #37

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer using {}.hasOwnProperty. More deterministic, fewer walks up the scope chain, fewer member accesses, shorter.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with O.p.hasOwnProperty or {}.hasOwnProperty. Shouldn't spend too much time worrying about micro-optimizations.

@michaelficarra
Copy link
Contributor

Beautiful pull request! +1.

@fitzgen
Copy link
Contributor

fitzgen commented Mar 18, 2013

Thank you very much for the pull request! Reviewing it now, will add comments inline...

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a note about the sourcesContent property in the comment for the SourceMapConsumer constructor?

@fitzgen
Copy link
Contributor

fitzgen commented Mar 18, 2013

So this looks great, I would love to merge it in as soon as the little nits are taken care of, and we figure out what's up with SourceNodes and source contents.

(I know I already approved the proposed API, but I didn't think of it then, sorry!)

@sokra
Copy link
Contributor Author

sokra commented Mar 19, 2013

As an alternative to the additional parameter in the SourceNode constructor:

  • an additional method setSourceContent(aSourceFile, aSourceContent) which propergates into a call on the resulting SourceMapGenerator.
var node = new SourceNode(); node.add("(function() {"); var content = fs.readFileSync("file.js"); var lines = content.split("\n"); lines.forEach(function(line, idx) { node.add(" "); node.add(new SourceNode(idx, 0, line, "file.js")); node.add("\n"); }); node.setSourceContent("file.js", content);
  • walkSourceContents, which walks all nodes and call the parameter function with source file and content
@sokra
Copy link
Contributor Author

sokra commented Mar 19, 2013

I'll split the SourceNode changes into another pull request. So you may merge the remaining changes...

@fitzgen fitzgen merged commit a2b9051 into mozilla:master Mar 19, 2013
@fitzgen
Copy link
Contributor

fitzgen commented Mar 19, 2013

Thanks a lot!

@sokra
Copy link
Contributor Author

sokra commented Mar 19, 2013

I moved the SourceNode changes to this branch and the alternative to pull request #45 for discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants