Skip to content

Commit

Permalink
fix(compiler-core): typeof should be allowed in browser expression va…
Browse files Browse the repository at this point in the history
…lidation (vuejs#7037)
  • Loading branch information
s-rigaud authored and chrislone committed Feb 4, 2023
1 parent 418d1b2 commit e41ad97
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/compiler-core/src/validateExpression.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// these keywords should not appear inside expressions, but operators like

import { SimpleExpressionNode } from './ast'
import { TransformContext } from './transform'
import { createCompilerError, ErrorCodes } from './errors'

// typeof, instanceof and in are allowed
// these keywords should not appear inside expressions, but operators like
// 'typeof', 'instanceof', and 'in' are allowed
const prohibitedKeywordRE = new RegExp(
'\\b' +
(
'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
'super,throw,while,yield,delete,export,import,return,switch,default,' +
'extends,finally,continue,debugger,function,arguments,typeof,void'
'arguments,await,break,case,catch,class,const,continue,debugger,default,' +
'delete,do,else,export,extends,finally,for,function,if,import,let,new,' +
'return,super,switch,throw,try,var,void,while,with,yield'
)
.split(',')
.join('\\b|\\b') +
Expand Down

0 comments on commit e41ad97

Please sign in to comment.