Add more operator overloads + tests (#55)

* operator '-'
* operator '*'
* operator '/'
* operator '%'
* operator '&'
* operator '|'
* operator '^'
This commit is contained in:
Max Graey
2018-03-25 14:14:53 +03:00
committed by Daniel Wirtz
parent 710fcefd72
commit 70d2a0a425
6 changed files with 1988 additions and 7 deletions

View File

@ -675,6 +675,34 @@ export class Program extends DiagnosticEmitter {
classPrototype.fnConcat = prototype.simpleName;
break;
}
case "-": {
classPrototype.fnSubtract = prototype.simpleName;
break;
}
case "*": {
classPrototype.fnMultiply = prototype.simpleName;
break;
}
case "/": {
classPrototype.fnDivide = prototype.simpleName;
break;
}
case "%": {
classPrototype.fnFractional = prototype.simpleName;
break;
}
case "&": {
classPrototype.fnBitwiseAnd = prototype.simpleName;
break;
}
case "|": {
classPrototype.fnBitwiseOr = prototype.simpleName;
break;
}
case "^": {
classPrototype.fnBitwiseXor = prototype.simpleName;
break;
}
case "==": {
classPrototype.fnEquals = prototype.simpleName;
break;
@ -2833,6 +2861,20 @@ export class ClassPrototype extends Element {
fnIndexedSet: string | null = null;
/** Overloaded concatenation method, if any. */
fnConcat: string | null = null;
/** Overloaded subtraction method, if any. */
fnSubtract: string | null = null;
/** Overloaded multiply method, if any. */
fnMultiply: string | null = null;
/** Overloaded divide method, if any. */
fnDivide: string | null = null;
/** Overloaded fractional method, if any. */
fnFractional: string | null = null;
/** Overloaded bitwise and method, if any. */
fnBitwiseAnd: string | null = null;
/** Overloaded bitwise or method, if any. */
fnBitwiseOr: string | null = null;
/** Overloaded bitwise xor method, if any. */
fnBitwiseXor: string | null = null;
/** Overloaded equality comparison method, if any. */
fnEquals: string | null = null;