fixed(spy): support `SpyObject` in Typescript as well
- allow `@IMPLEMENTS` as a decorator - implement empty `noSuchMethod`
This commit is contained in:
parent
f6cd26b0a6
commit
d773b6a00a
|
@ -45,7 +45,12 @@ export function CONST() {
|
||||||
|
|
||||||
export class ABSTRACT {}
|
export class ABSTRACT {}
|
||||||
|
|
||||||
export class IMPLEMENTS {}
|
// Note: This is only a marker annotation needed for ts2dart.
|
||||||
|
// This is written so that is can be used as a Traceur annotation
|
||||||
|
// or a Typescript decorator.
|
||||||
|
export function IMPLEMENTS(_) {
|
||||||
|
return (t) => t;
|
||||||
|
}
|
||||||
|
|
||||||
export function isPresent(obj): boolean {
|
export function isPresent(obj): boolean {
|
||||||
return obj !== undefined && obj !== null;
|
return obj !== undefined && obj !== null;
|
||||||
|
|
|
@ -299,6 +299,9 @@ export class SpyObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Noop so that SpyObject has the smae interface as in Dart
|
||||||
|
noSuchMethod(args) {}
|
||||||
|
|
||||||
spy(name) {
|
spy(name) {
|
||||||
if (!this[name]) {
|
if (!this[name]) {
|
||||||
this[name] = this._createGuinnessCompatibleSpy(name);
|
this[name] = this._createGuinnessCompatibleSpy(name);
|
||||||
|
|
Loading…
Reference in New Issue