Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 78d37e4

Browse files
committed
Merge pull request #367 from ochafik/fix-future-ctors
fix: Future.{value,error} are named constructors, not statics
1 parent cb0f538 commit 78d37e4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/facade_converter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,10 +770,12 @@ export class FacadeConverter extends base.TranspilerBase {
770770
};
771771
private es6PromisesProp: ts.Map<PropertyHandler> = {
772772
'resolve': (p: ts.PropertyAccessExpression) => {
773+
this.emit('new ');
773774
this.visit(p.expression);
774775
this.emit('.value');
775776
},
776777
'reject': (p: ts.PropertyAccessExpression) => {
778+
this.emit('new ');
777779
this.visit(p.expression);
778780
this.emit('.error');
779781
},

test/facade_converter_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ var y = x.length;`);
254254
it('translates into Futures', () => {
255255
expectWithTypes('let x: Promise = Promise.resolve(1);').to.equal(`import "dart:async";
256256
257-
Future x = Future.value(1);`);
257+
Future x = new Future.value(1);`);
258258
expectWithTypes('let x: Promise = Promise.reject(1);').to.equal(`import "dart:async";
259259
260-
Future x = Future.error(1);`);
260+
Future x = new Future.error(1);`);
261261
expectWithTypes('let x: Promise = new Promise((resolve) => {resolve(1);});')
262262
.to.equal(`import "dart:async";
263263

0 commit comments

Comments
 (0)