fix weird legacy acorn formatting

This commit is contained in:
Sebastian McKenzie 2015-08-24 15:31:41 -04:00
parent 032ca7ae1c
commit 6e24626482

View File

@ -27,8 +27,11 @@ export class Token {
function codePointToString(code) { function codePointToString(code) {
// UTF-16 Decoding // UTF-16 Decoding
if (code <= 0xFFFF) return String.fromCharCode(code); if (code <= 0xFFFF) {
return String.fromCharCode(((code - 0x10000) >> 10) + 0xD800, ((code - 0x10000) & 1023) + 0xDC00); return String.fromCharCode(code);
} else {
return String.fromCharCode(((code - 0x10000) >> 10) + 0xD800, ((code - 0x10000) & 1023) + 0xDC00);
}
} }
export default class Tokenizer { export default class Tokenizer {
@ -138,10 +141,11 @@ export default class Tokenizer {
readToken(code) { readToken(code) {
// Identifier or keyword. '\uXXXX' sequences are allowed in // Identifier or keyword. '\uXXXX' sequences are allowed in
// identifiers, so '\' also dispatches to that. // identifiers, so '\' also dispatches to that.
if (isIdentifierStart(code, true) || code === 92 /* '\' */) if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
return this.readWord(); return this.readWord();
} else {
return this.getTokenFromCode(code); return this.getTokenFromCode(code);
}
} }
fullCharCodeAtPos() { fullCharCodeAtPos() {
@ -166,6 +170,7 @@ export default class Tokenizer {
this.state.tokens.push(comment); this.state.tokens.push(comment);
this.state.comments.push(comment); this.state.comments.push(comment);
} }
this.addComment(comment); this.addComment(comment);
} }