Skip to content

Commit

Permalink
Fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
TimvdLippe committed Feb 25, 2018
1 parent 13b834d commit 79d05b8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 61 deletions.
18 changes: 0 additions & 18 deletions lib/mixins/property-effects.html
Original file line number Diff line number Diff line change
Expand Up @@ -821,24 +821,6 @@

const emptyArray = [];

// Regular expressions used for binding
const IDENT = '(?:' + '[a-zA-Z_$][\\w.:$\\-*]*' + ')';
const NUMBER = '(?:' + '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?' + ')';
const SQUOTE_STRING = '(?:' + '\'(?:[^\'\\\\]|\\\\.)*\'' + ')';
const DQUOTE_STRING = '(?:' + '"(?:[^"\\\\]|\\\\.)*"' + ')';
const STRING = '(?:' + SQUOTE_STRING + '|' + DQUOTE_STRING + ')';
const ARGUMENT = '(?:(' + IDENT + '|' + NUMBER + '|' + STRING + ')\\s*' + ')';
const ARGUMENTS = '(?:' + ARGUMENT + '(?:,\\s*' + ARGUMENT + ')*' + ')';
const ARGUMENT_LIST = '(?:' + '\\(\\s*' +
'(?:' + ARGUMENTS + '?' + ')' +
'\\)\\s*' + ')';
const BINDING = '(' + IDENT + '\\s*' + ARGUMENT_LIST + '?' + ')'; // Group 3
const OPEN_BRACKET = '(\\[\\[|{{)' + '\\s*';
const CLOSE_BRACKET = '(?:]]|}})';
const NEGATE = '(?:(!)\\s*)?'; // Group 2
const EXPRESSION = OPEN_BRACKET + NEGATE + BINDING + CLOSE_BRACKET;
const bindingRegex = new RegExp(EXPRESSION, "g");

/**
* Create a string from binding parts of all the literal parts
*
Expand Down
85 changes: 42 additions & 43 deletions lib/utils/binding-parser.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
this.bindingData = {
dependencies: []
};
/* eslint-disable no-fallthrough */

const STATE = {
INITIAL: (char, i) => {
Expand Down Expand Up @@ -172,52 +173,49 @@
}
}
},
METHOD: (binding) => {
let escaped = false;
return (char, i) => {
//console.log('METHOD')
switch (char) {
case ')': {
const methodName = this.bindingData.signature.methodName;
const dynamicFns = templateInfo.dynamicFns;
if (dynamicFns && dynamicFns[methodName] || this.bindingData.signature.static) {
this.bindingData.dependencies.push(methodName);
this.bindingData.signature.dynamicFn = true;
}
const name = text.substring(this._startChar, i).trim();
this.bindingData.mode = binding;
if (name) {
this.bindingData.signature.args.push({
name
});
this.bindingData.dependencies.push(name)
}
this._storeBindingData();
return STATE.METHODCLOSED(binding)
METHOD: (binding) => (char, i) => {
//console.log('METHOD')
switch (char) {
case ')': {
const methodName = this.bindingData.signature.methodName;
const dynamicFns = templateInfo.dynamicFns;
if (dynamicFns && dynamicFns[methodName] || this.bindingData.signature.static) {
this.bindingData.dependencies.push(methodName);
this.bindingData.signature.dynamicFn = true;
}
case ',': {
const name = text.substring(this._startChar, i).trim();
if (name) {
this.bindingData.signature.args.push({
name
});
this.bindingData.dependencies.push(name)
}
this._startChar = i + 1;
break;
const name = text.substring(this._startChar, i).trim();
this.bindingData.mode = binding;
if (name) {
this.bindingData.signature.args.push({
name
});
this.bindingData.dependencies.push(name)
}
case '\'':
case '"': {
return STATE.STRINGARG(binding, char);
this._storeBindingData();
return STATE.METHODCLOSED(binding)
}
case ',': {
const name = text.substring(this._startChar, i).trim();
if (name) {
this.bindingData.signature.args.push({
name
});
this.bindingData.dependencies.push(name)
}
this._startChar = i + 1;
break;
}
case '\'':
case '"': {
return STATE.STRINGARG(binding, char);
}
default: {
if (char >= '0' && char <= '9' || char === '-') {
return STATE.NUMBERARG(binding)
}
default: {
if (char >= '0' && char <= '9' || char === '-') {
return STATE.NUMBERARG(binding)
}

if (char != ' ' && char != '\n') {
return STATE.VARIABLEARG(binding)
}
if (char != ' ' && char != '\n') {
return STATE.VARIABLEARG(binding)
}
}
}
Expand Down Expand Up @@ -358,6 +356,7 @@
}
}
}
/* eslint-enable no-fallthrough */

let state = STATE.INITIAL;
let i,l;
Expand Down Expand Up @@ -390,7 +389,7 @@
};
}

};
}

Polymer.BindingParser = BindingParser;
})();
Expand Down

0 comments on commit 79d05b8

Please sign in to comment.