Skip to content

Commit 34cdf22

Browse files
committed
Fixed tests
1 parent e3efa58 commit 34cdf22

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/compiler.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,8 +2961,8 @@ export class Compiler extends DiagnosticEmitter {
29612961
}
29622962
}
29632963
// Check if a converting to an Interface
2964-
if (toType.is(TypeFlags.REFERENCE)) {
2965-
assert(toType.classReference != null && toType.classReference != null);
2964+
if (toType.is(TypeFlags.REFERENCE) && !toType.isFunction) {
2965+
assert(toType.classReference != null && fromType.classReference != null);
29662966
if (toType.classReference!.kind == ElementKind.INTERFACE) {
29672967
(<Interface>toType.classReference!).implementers.add(fromType.classReference!);
29682968
}
@@ -6223,11 +6223,6 @@ export class Compiler extends DiagnosticEmitter {
62236223
}
62246224
var parameterTypes = signature.parameterTypes;
62256225
for (let i = 0; i < numArguments; ++i, ++index) {
6226-
if (parameterTypes[i].is(TypeFlags.REFERENCE)) {
6227-
6228-
}
6229-
let arg_type = this.resolver.resolveExpression(argumentExpressions[i], this.currentFlow);
6230-
62316226
operands[index] = this.compileExpression(argumentExpressions[i], parameterTypes[i],
62326227
Constraints.CONV_IMPLICIT
62336228
);
@@ -9151,6 +9146,7 @@ export class Compiler extends DiagnosticEmitter {
91519146

91529147
compileVirtualTable(): void {
91539148
const interfaces = this.program.interfaces;
9149+
if (interfaces.length == 0) return; //Don't create table if no interfaces present
91549150
const instanceMethods: Map<number, Map<number, Function>> = new Map();
91559151
const interfaceMethods: Map<number, Function[]> = new Map();
91569152
// Gather all instatiated interface methods

src/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ export class Type {
173173
return classReference !== null && classReference.hasDecorator(DecoratorFlags.UNMANAGED);
174174
}
175175

176+
get isFunction(): bool {
177+
var signature = this.signatureReference;
178+
return signature != null && this.is(TypeFlags.REFERENCE);
179+
}
180+
176181
/** Computes the sign-extending shift in the target type. */
177182
computeSmallIntegerShift(targetType: Type): u32 {
178183
return targetType.size - this.size;

std/portable/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ interface Iterable<T> {
569569

570570
//TODO: interface Iterator<T, TReturn = any, TNext = undefined> {}
571571
// Breaks
572-
interface Iterator<T> {}
572+
interface Iterator<T, TReturn = any, TNext = undefined> {}
573573

574574
interface IMath {
575575
readonly E: f64;

0 commit comments

Comments
 (0)