add babylon hasFeature util method

This commit is contained in:
Sebastian McKenzie
2015-09-15 06:15:19 +01:00
parent ae85fc0251
commit 59948c6649
3 changed files with 10 additions and 11 deletions

View File

@@ -308,7 +308,7 @@ export default class Tokenizer {
var width = 1;
var next = this.input.charCodeAt(this.state.pos + 1);
if (next === 42 && this.options.features["es7.exponentiationOperator"]) { // '*'
if (next === 42 && this.hasFeature("exponentiationOperator")) { // '*'
width++;
next = this.input.charCodeAt(this.state.pos + 2);
type = tt.exponent;
@@ -411,7 +411,7 @@ export default class Tokenizer {
case 125: ++this.state.pos; return this.finishToken(tt.braceR);
case 58:
if (this.options.features["es7.functionBind"] && this.input.charCodeAt(this.state.pos + 1) === 58) {
if (this.hasFeature("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) {
return this.finishOp(tt.doubleColon, 2);
} else {
++this.state.pos;

View File

@@ -60,7 +60,6 @@ export default class State {
// Used to signal to callers of `readWord1` whether the word
// contained any escape sequences. This is needed because words with
// escape sequences must not be interpreted as keywords.
this.containsEsc = false;
return this;