Skip to content

handle multiple prologue directives #25561

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 4 commits into from
Jul 11, 2018

Conversation

ajafff
Copy link
Contributor

@ajafff ajafff commented Jul 10, 2018

Fixes: #24689

@mhegazy mhegazy requested review from weswigham and rbuckton July 10, 2018 21:56
@mhegazy
Copy link
Contributor

mhegazy commented Jul 10, 2018

@rbuckton and @weswigham can you please review this change

let statementIndex = 0;
// skip all prologue directives to insert at the correct position
for (; statementIndex < to.length; ++statementIndex) {
if (!isPrologueDirective(to[statementIndex])) {
Copy link
Contributor

@rbuckton rbuckton Jul 10, 2018

Choose a reason for hiding this comment

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

prependStatements shouldn't care about prologue directives. This logic should be handled elsewhere at the call site instead.

Copy link
Member

@weswigham weswigham Jul 10, 2018

Choose a reason for hiding this comment

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

Just rename prependStatements - every single one of it's callsites needs to do this.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's probably fine. The general-purpose name of prependStatements means it could be used in any place where there's a statement list, including a Block or a CaseClause, which don't support prologue directives. Giving it a more specific name would remove that concern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@mhegazy
Copy link
Contributor

mhegazy commented Jul 11, 2018

@rbuckton one more look?

@mhegazy mhegazy merged commit 2d0d655 into microsoft:master Jul 11, 2018
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.

4 participants