Skip to content

More progress on uncurry level removal #12785

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 2 commits into from
Nov 7, 2017

Conversation

slavapestov
Copy link
Contributor

Almost gone!

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit ec343c6 into swiftlang:master Nov 7, 2017
@slavapestov
Copy link
Contributor Author

@gottesmm You might want to take a quick look at this one. Just mechanical changes, no effect on generated SIL.

Copy link
Contributor

@gottesmm gottesmm left a comment

Choose a reason for hiding this comment

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

Some requests for more documentation.

@@ -1327,7 +1327,7 @@ bool SILParser::parseSILDeclRef(SILDeclRef &Result,

// Construct SILDeclRef.
Result = SILDeclRef(VD, Kind, expansion, /*isCurried=*/false, IsObjC);
if (uncurryLevel < Result.getUncurryLevel())
if (uncurryLevel < Result.getParameterListCount() - 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using a constant - 1 here, can you turn this into a method on Result with a descriptive name/comment.

if (kind == Kind::DefaultArgGenerator)
return 0;
return getNaturalUncurryLevel(getDecl());
unsigned SILDeclRef::getParameterListCount() const {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add more documentation here and use early-exits instead of else-if return?

What I want is for each case to say /why/ it has X amounts of parameters. For instance, why does ClassDecl have 2 parameters? It would also be nice to have a bigger comment explaining this methods use/importance in the larger world of SIL.

@@ -1777,7 +1777,7 @@ static bool isImporterGeneratedAccessor(const clang::Decl *clangDecl,
return false;

// Must be a type member.
if (constant.getUncurryLevel() != 1)
if (constant.getParameterListCount() != 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment here why you are checking against 2? Couldn't this be a method on SILDeclRef with a nice comment that explains what is happening here?

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.

2 participants