Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespaces are being omitted #2775

Closed
e111077 opened this issue Feb 28, 2018 · 4 comments
Closed

Namespaces are being omitted #2775

e111077 opened this issue Feb 28, 2018 · 4 comments

Comments

@e111077
Copy link
Contributor

e111077 commented Feb 28, 2018

When a namespace is defined, it seems as if the modulizer is ignoring it. e.g.

/**
 * @namespace
 * @memberof Polymer
 */
Polymer.MyNamespace {
  /**
   * @memberof Polymer.MyNamespace
   */
  myMethod() { return somFn.bind(this); }
}

is converted to

export function myMethod() { return someFn.bind(Polymer.MyNamespace); }
// but Polymer is undefined and so is MyNamespace

see PolymerElements/iron-overlay-behavior/iron-scroll-manager.html _lockScrollInteractions

before

after

@justinfagnani
Copy link
Contributor

justinfagnani commented Mar 16, 2018

This is a case that our this rewriting for namespaces isn't catching.

The specific lines being transformed incorrectly are:

A simplified version is:

Polymer.MyNamespace {
  methodA() {...}

  methodB() {
    return this.methodA.bind(this);
  }
}

I'd rather fix this by hand after conversion, but if the goal is to keep 2.x source as the source-of-truth, then we'll have to extend the heuristic to recognize this.<function>.bind(this) so we can output:

export function methodA() {...}

export function methodB() {
  return methodA;
}

@justinfagnani
Copy link
Contributor

cc @FredKSchott @kevinpschaaf and @graynorton

I'm not sure how many more issues like this we have to get to 100% automation on our elements, but we're in the long tail for sure, IMO.

@e111077
Copy link
Contributor Author

e111077 commented May 2, 2018

spoken offline, we also suggested fixing this issue by making modulizer substitute undefined for this when used in a function

e111077 referenced this issue in Polymer/polymer-modulizer May 3, 2018
e111077 referenced this issue in Polymer/polymer-modulizer May 4, 2018
@bicknellr
Copy link
Member

bicknellr commented May 4, 2018

Is this closable after #416 or is this different?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants