Skip to content

Consider module accessor a JSGetter #2541

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

Merged
merged 1 commit into from
Jul 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,17 @@ trait JSGlobalAddons extends JSDefinitions

/** has this symbol to be translated into a JS getter (both directions)? */
def isJSGetter(sym: Symbol): Boolean = {
sym.tpe.params.isEmpty && enteringUncurryIfAtPhaseAfter {
/* We only get here when `sym.isMethod`, thus `sym.isModule` implies that
* `sym` is the module's accessor. In 2.12, module accessors are synthesized
* after uncurry, thus their first info is a MethodType at phase fields.
*/
sym.isModule || (sym.tpe.params.isEmpty && enteringUncurryIfAtPhaseAfter {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only get here when sym.isMethod, thus sym.isModule can only hold for the module's accessor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you write that as a comment in the code?

See https://github.com/scala-js/scala-js/blob/master/CODINGSTYLE.md#non-scaladoc-comments for the style we use for comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do tomorrow!

sym.tpe match {
case _: NullaryMethodType => true
case PolyType(_, _: NullaryMethodType) => true
case _ => false
}
}
})
}

/** has this symbol to be translated into a JS setter (both directions)? */
Expand Down