Skip to content

Simplify ClassfileParser#innerClasses#classSymbol #3813

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
Feb 1, 2018

Conversation

smarter
Copy link
Member

@smarter smarter commented Jan 11, 2018

  • Avoid redundant calls to get
  • Fix indentation of getMember and add some brackets to make it clearer

@smarter smarter requested a review from nicolasstucki January 11, 2018 23:10
val owner = classNameToSymbol(outerName)
val result = ctx.atPhaseNotLaterThan(ctx.typerPhase) { implicit ctx =>
getMember(owner, innerName.toTypeName)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Simpler?

getMember(owner, innerName.toTypeName)(ctx.withPhaseNoLater(ctx.typerPhase))

}
assert(result ne NoSymbol,
i"""failure to resolve inner class:
|externalName = ${entry.externalName},
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation is off

}
}
else {
if (sym == classRoot.symbol)
Copy link
Contributor

Choose a reason for hiding this comment

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

You could reduce nesting:

if (isStatic(entry.jflags)) {
  ...
}
else if (sym == classRoot.symbol)
  instanceScope.lookup(name)
else
  sym.info.member(name).symbol

- Avoid redundant calls to get
- Fix indentation of getMember and add some brackets to make it clearer
@smarter smarter force-pushed the optimize-classfileparser branch from 1a1e932 to 3c0efe8 Compare February 1, 2018 14:19
@smarter
Copy link
Member Author

smarter commented Feb 1, 2018

Comments addressed, thanks @allanrenucci !

@smarter smarter removed the stat:wip label Feb 1, 2018
@smarter smarter merged commit 6998fd0 into scala:master Feb 1, 2018
@allanrenucci allanrenucci deleted the optimize-classfileparser branch February 1, 2018 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants