Skip to content

Commit 9f9cde1

Browse files
authored
move Token.ASTERISK_ASTERISK to general group in resolveBinaryExpression (AssemblyScript#2114)
1 parent d802fa4 commit 9f9cde1

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

src/resolver.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,30 +1957,7 @@ export class Resolver extends DiagnosticEmitter {
19571957
case Token.MINUS:
19581958
case Token.ASTERISK:
19591959
case Token.SLASH:
1960-
case Token.PERCENT: { // mod has special logic, but also behaves like this
1961-
let leftType = this.resolveExpression(left, ctxFlow, ctxType, reportMode);
1962-
if (!leftType) return null;
1963-
let classReference = leftType.getClassOrWrapper(this.program);
1964-
if (classReference) {
1965-
let overload = classReference.lookupOverload(OperatorKind.fromBinaryToken(operator));
1966-
if (overload) return overload.signature.returnType;
1967-
}
1968-
let rightType = this.resolveExpression(right, ctxFlow, leftType, reportMode);
1969-
if (!rightType) return null;
1970-
let commonType = Type.commonDenominator(leftType, rightType, false);
1971-
if (!commonType) {
1972-
if (reportMode == ReportMode.REPORT) {
1973-
this.error(
1974-
DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,
1975-
node.range, leftType.toString(), rightType.toString()
1976-
);
1977-
}
1978-
}
1979-
return commonType;
1980-
}
1981-
1982-
// pow: result is common type of LHS and RHS, preferring overloads
1983-
1960+
case Token.PERCENT: // mod has special logic, but also behaves like this
19841961
case Token.ASTERISK_ASTERISK: {
19851962
let leftType = this.resolveExpression(left, ctxFlow, ctxType, reportMode);
19861963
if (!leftType) return null;

0 commit comments

Comments
 (0)