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

method closures need binding #44

Closed
jmesserly opened this issue Feb 12, 2015 · 5 comments
Closed

method closures need binding #44

jmesserly opened this issue Feb 12, 2015 · 5 comments

Comments

@jmesserly
Copy link
Contributor

given obj.method in Dart, I suspect DDC currently generates obj.method in JS. That won't work. Static codegen should be obj.method.bind(obj) and dynamic gets will need to handle this as well. Perhaps a helper so we don't have to repeat obj: dart.bind(obj, 'method')

@jmesserly
Copy link
Contributor Author

another option is a closure wrap like solution: (...args) => obj.method(...args)

regardless I think we need to support == operator on these: Iff identical(o1, o2) then o1.m == o2.m. from "16.18.1 Closurization" in dart language spec 2

@jmesserly jmesserly added the js label Feb 12, 2015
@jmesserly
Copy link
Contributor Author

similar TODO that I just noticed:

Getter returning a function with a call method, we don't generate the .call correctly.

@jmesserly
Copy link
Contributor Author

also, we may wish to preserve the fact that it was a "dart object", which would lean to the dart.bind approach

@jmesserly
Copy link
Contributor Author

closing for now, but we'll need to revisit identity issues (those should be covered by language tests)

@jmesserly
Copy link
Contributor Author

implementation was 4138cbc

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant