Skip to content

Fixed a bug in StmtConditionElement::getSourceRange where it would create invalid source ranges #5323

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 3 commits into from
Oct 18, 2016
Merged

Conversation

mxswd
Copy link
Contributor

@mxswd mxswd commented Oct 16, 2016

Fixed a bug in StmtConditionElement::getSourceRange where it would create invalid source ranges.

This bug was causing an assert. Now it creates valid source ranges.

…eate invalid source ranges

This bug was causing an assert.
@mxswd
Copy link
Contributor Author

mxswd commented Oct 16, 2016

@jrose-apple

else
Start = getPattern()->getStartLoc();

SourceLoc End = getInitializer()->getEndLoc();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm really not happy with this duplicated logic. At this point it probably makes sense to just not implement getStartLoc and getEndLoc, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought not because of the bool and availability cases, they never need to find the other loc when asked.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose that's true. In that case, maybe in this case it delegates to getSourceRange?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then it would recheck the kind, we could just make a static function for this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Inlining should take care of that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok then. I will update it.

@mxswd
Copy link
Contributor Author

mxswd commented Oct 18, 2016

Amended.

@jrose-apple
Copy link
Contributor

@swift-ci Please smoke test and merge

1 similar comment
@jrose-apple
Copy link
Contributor

@swift-ci Please smoke test and merge

@swift-ci swift-ci merged commit 57da0f5 into swiftlang:master Oct 18, 2016
@mxswd mxswd deleted the fix-stmtconditionelement branch October 18, 2016 23:23
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