-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
BREAKING CHANGE: Use ES2015 syntax #84
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of nits.
lib/webidl2.js
Outdated
JSON.stringify(this.tokens, null, 4); | ||
}; | ||
toString() { | ||
return this.message + ", line " + this.line + " (tokens: '" + this.input + "')\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use template literal here?
lib/webidl2.js
Outdated
function error(str) { | ||
let tok = ""; | ||
let numTokens = 0; | ||
const maxTokens = 5; | ||
while (numTokens < maxTokens && tokens.length > numTokens) { | ||
tok += tokens[numTokens].value; | ||
numTokens++; | ||
} | ||
throw new WebIDLParseError(str, line, tok, tokens.slice(0, 5)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should fix this now:
throw new WebIDLParseError(str, line, tok, tokens.slice(0, maxTokens))
@@ -714,15 +718,15 @@ | |||
consume(OTHER, ";") || error("Missing semicolon after interface"); | |||
return ret; | |||
} | |||
var ea = extended_attrs(store ? mems : null); | |||
const ea = extended_attrs(store ? mems : null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: whitespace ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be nice if we got rid of the const x = {}, y = {};
etc. pattern usage and instead do "const x = {}; const y = {}" and so on. The "," is a pretty bad practice. We can do that in different PR tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: whitespace ?
Could you clarify more? extended_attrs
already calls all_ws
internally so no need to process whitespaces twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, I meant changing:
const mems = [],
ret = {};
To:
const mems = [];
const ret = {};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With regards to whitespace.... I literally meant that the indentation of your code is incorrect - just a nit :) The actual processing is all good 👍
We need to update the travis file as per #82 (i.e., drop node 4):
I don't know if this works, but we could try:
|
Not adding |
Ah, good point. Yeah, we probably want to test whatever is latest. I have to run off for a bit, can you please check travisci docs for how to do that? |
https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#Specifying-Node.js-versions
Current |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saschanaz, sent you an invite with write access. Please merge.
I'll release after merge.
Please squash merge and use "BREAKING CHANGE: Use ES2015 syntax" as commit message. |
This is related to #82 but not really breaking compat with Node.js 4.
This PR converts:
var func = function() { }
style tofunction func() { }
var x
tolet x
orconst x
depending on the variable is reassigned or notfor (var i = 0; i < array.length; i++)
tofor (const item of array)
{ func: function () { } }
to{ func() { } }
PS: Now fixes #82 by removing it on
.travis.yml
.