Skip to content

Commit e6f89c0

Browse files
committed
error-detector code style tweak
1 parent fc6f181 commit e6f89c0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/compiler/error-detector.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22

33
import { dirRE, onRE } from './parser/index'
44

5-
// operators like typeof, instanceof and in are allowed
5+
// these keywords should not appear inside expressions, but operators like
6+
// typeof, instanceof and in are allowed
67
const prohibitedKeywordRE = new RegExp('\\b' + (
78
'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
89
'super,throw,while,yield,delete,export,import,return,switch,default,' +
910
'extends,finally,continue,debugger,function,arguments'
1011
).split(',').join('\\b|\\b') + '\\b')
12+
13+
// these unary operators should not be used as property/method names
1114
const unaryOperatorsRE = new RegExp('\\b' + (
1215
'delete,typeof,void'
1316
).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)')
17+
1418
// check valid identifier for v-for
1519
const identRE = /[A-Za-z_$][\w$]*/
20+
1621
// strip strings in expressions
1722
const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g
1823

0 commit comments

Comments
 (0)