diff --git a/lib/facade_converter.ts b/lib/facade_converter.ts index f802895..ff8afe8 100644 --- a/lib/facade_converter.ts +++ b/lib/facade_converter.ts @@ -674,10 +674,12 @@ export class FacadeConverter extends base.TranspilerBase { }; private es6PromisesProp: ts.Map = { 'resolve': (p: ts.PropertyAccessExpression) => { + this.emit('new '); this.visit(p.expression); this.emit('.value'); }, 'reject': (p: ts.PropertyAccessExpression) => { + this.emit('new '); this.visit(p.expression); this.emit('.error'); }, diff --git a/test/facade_converter_test.ts b/test/facade_converter_test.ts index a6ba7f4..bd18a0a 100644 --- a/test/facade_converter_test.ts +++ b/test/facade_converter_test.ts @@ -238,10 +238,10 @@ var y = x.length;`); it('translates into Futures', () => { expectWithTypes('let x: Promise = Promise.resolve(1);').to.equal(`import "dart:async"; -Future x = Future.value(1);`); +Future x = new Future.value(1);`); expectWithTypes('let x: Promise = Promise.reject(1);').to.equal(`import "dart:async"; -Future x = Future.error(1);`); +Future x = new Future.error(1);`); expectWithTypes('let x: Promise = new Promise((resolve) => {resolve(1);});') .to.equal(`import "dart:async";