remove of from operator. need more test.

This commit is contained in:
jchbh 2015-05-22 10:02:41 -07:00
parent a9d77afe80
commit 014f873ec1

View File

@ -44,7 +44,7 @@
"use strict";
var KEYWORDS = 'break case catch const continue debugger default delete do else finally for function if in of instanceof new return yield switch throw try typeof var let void while with';
var KEYWORDS = 'break case catch const continue debugger default delete do else finally for function if in instanceof new return yield switch throw try typeof var let void while with';
var KEYWORDS_ATOM = 'false null true';
var RESERVED_WORDS = 'abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized this throws transient volatile yield'
+ " " + KEYWORDS_ATOM + " " + KEYWORDS;
@ -63,7 +63,6 @@ var RE_DEC_NUMBER = /^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i;
var OPERATORS = makePredicate([
"in",
"of",
"instanceof",
"typeof",
"new",
@ -613,7 +612,7 @@ var PRECEDENCE = (function(a, ret){
["^"],
["&"],
["==", "===", "!=", "!=="],
["<", ">", "<=", ">=", "in", "of", "instanceof"],
["<", ">", "<=", ">=", "in", "instanceof"],
[">>", "<<", ">>>"],
["+", "-"],
["*", "/", "%"]
@ -934,7 +933,7 @@ function parse($TEXT, options) {
next();
return for_in(init);
}
if (is("operator", "of")) {
if (is("name", "of")) {
if (init instanceof AST_Var && init.definitions.length > 1)
croak("Only one variable declaration allowed in for..of loop");
next();
@ -1420,7 +1419,7 @@ function parse($TEXT, options) {
var expr_op = function(left, min_prec, no_in) {
var op = is("operator") ? S.token.value : null;
if ((op == "in" || op == "of")&& no_in) op = null;
if (op == "in"&& no_in) op = null;
var prec = op != null ? PRECEDENCE[op] : null;
if (prec != null && prec > min_prec) {
next();