angular-estree-parser
Advanced tools
Comparing version 10.1.0 to 10.2.0
@@ -263,10 +263,21 @@ import * as angular from '@angular/compiler'; | ||
} | ||
if (node instanceof angular.PrefixNot) { | ||
const isPrefixNot = node instanceof angular.PrefixNot; | ||
if (isPrefixNot || node instanceof angular.TypeofExpression) { | ||
const expression = this.#transform(node.expression); | ||
const operator = isPrefixNot ? '!' : 'typeof'; | ||
let { start } = node.sourceSpan; | ||
if (!isPrefixNot) { | ||
const index = this.text.lastIndexOf(operator, start); | ||
// istanbul ignore next 7 | ||
if (index === -1) { | ||
throw new Error(`Cannot find operator ${operator} from index ${start} in ${JSON.stringify(this.text)}`); | ||
} | ||
start = index; | ||
} | ||
return this.#create({ | ||
type: 'UnaryExpression', | ||
prefix: true, | ||
operator: '!', | ||
operator, | ||
argument: expression, | ||
start: node.sourceSpan.start, // ! | ||
start, | ||
end: getOuterEnd(expression), | ||
@@ -359,2 +370,3 @@ }, { hasParentParens: isInParentParens }); | ||
// PrefixNot | ||
// TypeofExpression | ||
function transform(node, text) { | ||
@@ -361,0 +373,0 @@ return new Transformer(node, text).node; |
{ | ||
"name": "angular-estree-parser", | ||
"version": "10.1.0", | ||
"version": "10.2.0", | ||
"description": "A parser that converts Angular source code into an ESTree-compatible form", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
44325
979