Skip to content

Commit 49695ed

Browse files
committed
Split up binary operators
1 parent f89db7d commit 49695ed

File tree

9 files changed

+186
-52
lines changed

9 files changed

+186
-52
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9244,7 +9244,7 @@ namespace ts {
92449244
}
92459245

92469246
function findFirstSuperCall(n: Node): Node {
9247-
if (isSuperCallExpression(n)) {
9247+
if (isSuperCall(n)) {
92489248
return n;
92499249
}
92509250
else if (isFunctionLike(n)) {
@@ -14407,7 +14407,7 @@ namespace ts {
1440714407
}
1440814408

1440914409
function containsSuperCall(n: Node): boolean {
14410-
if (isSuperCallExpression(n)) {
14410+
if (isSuperCall(n)) {
1441114411
return true;
1441214412
}
1441314413
else if (isFunctionLike(n)) {
@@ -14463,7 +14463,7 @@ namespace ts {
1446314463
let superCallStatement: ExpressionStatement;
1446414464

1446514465
for (const statement of statements) {
14466-
if (statement.kind === SyntaxKind.ExpressionStatement && isSuperCallExpression((<ExpressionStatement>statement).expression)) {
14466+
if (statement.kind === SyntaxKind.ExpressionStatement && isSuperCall((<ExpressionStatement>statement).expression)) {
1446714467
superCallStatement = <ExpressionStatement>statement;
1446814468
break;
1446914469
}

src/compiler/factory.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ namespace ts {
105105
export function createLiteral(textSource: StringLiteral | Identifier, location?: TextRange): StringLiteral;
106106
export function createLiteral(value: string, location?: TextRange): StringLiteral;
107107
export function createLiteral(value: number, location?: TextRange): NumericLiteral;
108+
export function createLiteral(value: boolean, location?: TextRange): BooleanLiteral;
108109
export function createLiteral(value: string | number | boolean, location?: TextRange): PrimaryExpression;
109110
export function createLiteral(value: string | number | boolean | StringLiteral | Identifier, location?: TextRange): PrimaryExpression {
110111
if (typeof value === "number") {
@@ -120,7 +121,7 @@ namespace ts {
120121
node.text = value;
121122
return node;
122123
}
123-
else {
124+
else if (value) {
124125
const node = <StringLiteral>createNode(SyntaxKind.StringLiteral, location, /*flags*/ undefined);
125126
node.textSourceNode = value;
126127
node.text = value.text;
@@ -497,14 +498,14 @@ namespace ts {
497498
return node;
498499
}
499500

500-
export function createTaggedTemplate(tag: Expression, template: Template, location?: TextRange) {
501+
export function createTaggedTemplate(tag: Expression, template: TemplateLiteral, location?: TextRange) {
501502
const node = <TaggedTemplateExpression>createNode(SyntaxKind.TaggedTemplateExpression, location);
502503
node.tag = parenthesizeForAccess(tag);
503504
node.template = template;
504505
return node;
505506
}
506507

507-
export function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: Template) {
508+
export function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral) {
508509
if (node.tag !== tag || node.template !== template) {
509510
return updateNode(createTaggedTemplate(tag, template, node), node);
510511
}

src/compiler/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3930,7 +3930,7 @@ namespace ts {
39303930
const tagExpression = <TaggedTemplateExpression>createNode(SyntaxKind.TaggedTemplateExpression, expression.pos);
39313931
tagExpression.tag = expression;
39323932
tagExpression.template = token() === SyntaxKind.NoSubstitutionTemplateLiteral
3933-
? parseLiteralNode()
3933+
? <NoSubstitutionTemplateLiteral>parseLiteralNode()
39343934
: parseTemplateExpression();
39353935
expression = finishNode(tagExpression);
39363936
continue;

src/compiler/transformers/es6.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ namespace ts {
982982
if (statementOffset < ctorStatements.length) {
983983
firstStatement = ctorStatements[statementOffset];
984984

985-
if (firstStatement.kind === SyntaxKind.ExpressionStatement && isSuperCallExpression((firstStatement as ExpressionStatement).expression)) {
985+
if (firstStatement.kind === SyntaxKind.ExpressionStatement && isSuperCall((firstStatement as ExpressionStatement).expression)) {
986986
const superCall = (firstStatement as ExpressionStatement).expression as CallExpression;
987987
superCallExpression = setOriginalNode(
988988
saveStateAndInvoke(superCall, visitImmediateSuperCallInBody),

src/compiler/transformers/generators.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,12 +657,12 @@ namespace ts {
657657
}
658658
}
659659

660-
function isCompoundAssignment(kind: SyntaxKind) {
660+
function isCompoundAssignment(kind: BinaryOperator): kind is CompoundAssignmentOperator {
661661
return kind >= SyntaxKind.FirstCompoundAssignment
662662
&& kind <= SyntaxKind.LastCompoundAssignment;
663663
}
664664

665-
function getOperatorForCompoundAssignment(kind: SyntaxKind) {
665+
function getOperatorForCompoundAssignment(kind: CompoundAssignmentOperator): BitwiseOperatorOrHigher {
666666
switch (kind) {
667667
case SyntaxKind.PlusEqualsToken: return SyntaxKind.PlusToken;
668668
case SyntaxKind.MinusEqualsToken: return SyntaxKind.MinusToken;

src/compiler/transformers/ts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ namespace ts {
989989
}
990990

991991
const statement = statements[index];
992-
if (statement.kind === SyntaxKind.ExpressionStatement && isSuperCallExpression((<ExpressionStatement>statement).expression)) {
992+
if (statement.kind === SyntaxKind.ExpressionStatement && isSuperCall((<ExpressionStatement>statement).expression)) {
993993
result.push(visitNode(statement, visitor, isStatement));
994994
return index + 1;
995995
}

0 commit comments

Comments
 (0)