dart-archive / ts2dart

ts2dart TypeScript to Dart transpiler
Apache License 2.0
181 stars 62 forks source link

Implement an inlined facade for Promises #340

Closed hansl closed 8 years ago

hansl commented 8 years ago

After this we don't need a Promise facade, unless for all, catch and race. I need a handler for then(a, b) => then(a).catch(b).

mprobst commented 8 years ago

Nice. Needs a bit more work/discussion, but good to see that stuff go away!

hansl commented 8 years ago

I reduced the generated code quite a bit. It's now closer to what someone would write if they were to implement the code by hand (assuming they couldn't change the function content). I think this is good enough for now, with a potential optimization of pushing the code in a function helper.

hansl commented 8 years ago

@alexeagle @mprobst PTAL.

mprobst commented 8 years ago

I agree that with the reduced code generation, this is ok without a library/helper func. We should keep that idea in mind though, that would be the better solution to Angular2's façade file.

mprobst commented 8 years ago

Looking really good already.

Given that we generate somewhat complicated Dart code, could you add an integration test in the e2e folder? That would ensure the generated code actually works...

alexeagle commented 8 years ago

Thanks for getting this in! I'm not going to review in any detail since @mprobst is giving an excellent thorough review already ;)

hansl commented 8 years ago

I've done the e2e test.