Browse Source
Merge pull request #8555 from thingsboard/tbl_as_js_null_safe
[3.5.1][Fix bug]tbel: Incorrect validation syntax with null field property
pull/8564/head
Andrew Shvayka
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
24 additions and
0 deletions
-
ui-ngx/src/app/shared/models/ace/tbel/worker-tbel.js
|
|
|
@ -5026,6 +5026,21 @@ var JSHINT = (function() { |
|
|
|
return that; |
|
|
|
}, 20); |
|
|
|
} |
|
|
|
function nullSafeProperty(s) { |
|
|
|
console.log("test " + s); |
|
|
|
symbol(s, 20).exps = true; |
|
|
|
return infix(s, function(context, left, that) { |
|
|
|
if (state.option.bitwise) { |
|
|
|
warning("W016", that, that.id); |
|
|
|
} |
|
|
|
|
|
|
|
checkLeftSideAssign(context, left, that); |
|
|
|
|
|
|
|
that.right = expression(context, 10); |
|
|
|
|
|
|
|
return that; |
|
|
|
}, 20); |
|
|
|
} |
|
|
|
function suffix(s) { |
|
|
|
var x = symbol(s, 150); |
|
|
|
|
|
|
|
@ -5539,6 +5554,9 @@ var JSHINT = (function() { |
|
|
|
bitwiseassignop("<<="); |
|
|
|
bitwiseassignop(">>="); |
|
|
|
bitwiseassignop(">>>="); |
|
|
|
|
|
|
|
nullSafeProperty(".?"); |
|
|
|
|
|
|
|
infix(",", function(context, left, that) { |
|
|
|
if (state.option.nocomma) { |
|
|
|
warning("W127", that); |
|
|
|
@ -9450,6 +9468,12 @@ Lexer.prototype = { |
|
|
|
|
|
|
|
switch (ch1) { |
|
|
|
case ".": |
|
|
|
if (ch1 === "." && this.peek(1) === "?") { |
|
|
|
return { |
|
|
|
type: Token.Punctuator, |
|
|
|
value: ".?" |
|
|
|
}; |
|
|
|
} |
|
|
|
if ((/^[0-9]$/).test(this.peek(1))) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|