mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(compiler): tighten Binary.operation type
Improve `Binary.operation` types
This commit is contained in:
parent
04ba09a8d9
commit
07a08ab9f8
1 changed files with 30 additions and 2 deletions
|
|
@ -268,11 +268,39 @@ export class Interpolation extends AST {
|
|||
}
|
||||
}
|
||||
|
||||
type AssignmentOperation = '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '**=' | '&&=' | '||=' | '??=';
|
||||
type BinaryOperation =
|
||||
| AssignmentOperation
|
||||
// Logical
|
||||
| '&&'
|
||||
| '||'
|
||||
| '??'
|
||||
// Equality
|
||||
| '=='
|
||||
| '!='
|
||||
| '==='
|
||||
| '!=='
|
||||
// Relational
|
||||
| '<'
|
||||
| '>'
|
||||
| '<='
|
||||
| '>='
|
||||
| 'in'
|
||||
// Additive
|
||||
| '+'
|
||||
| '-'
|
||||
// Multiplicative
|
||||
| '*'
|
||||
| '%'
|
||||
| '/'
|
||||
// Exponentiation
|
||||
| '**';
|
||||
|
||||
export class Binary extends AST {
|
||||
constructor(
|
||||
span: ParseSpan,
|
||||
sourceSpan: AbsoluteSourceSpan,
|
||||
public operation: string,
|
||||
public operation: BinaryOperation,
|
||||
public left: AST,
|
||||
public right: AST,
|
||||
) {
|
||||
|
|
@ -349,7 +377,7 @@ export class Unary extends Binary {
|
|||
sourceSpan: AbsoluteSourceSpan,
|
||||
public operator: string,
|
||||
public expr: AST,
|
||||
binaryOp: string,
|
||||
binaryOp: BinaryOperation,
|
||||
binaryLeft: AST,
|
||||
binaryRight: AST,
|
||||
) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue