Skip to content

[1/3] SourceLocation related refactoring. #5537

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 7 commits into from
Nov 30, 2018

Conversation

christianparpart
Copy link
Member

This pr is the earliest in the series of PRs that needs to be merged "in order" :-).

Motivation: I noticed, that we pass (CharStream, filename) almost always as pair to Scanner, and then use complex ways (via callback functions) to get back to some functions that can extract the source code fragments (duplicated API from CharStream into Scanner) inside the SourceReferenceFormatter.

Gains:

  • So the idea now is, to not pass CharStream and a source name to the scanner, but to simply pass a CharStream, that already knows the source name, to the Scanner.
  • This should eliminate the callback workaround as SourceLocation will have access to the CharStream already.

Prerequisite of: #5535 (is based on top of this PR)

@christianparpart christianparpart force-pushed the cp-SourceLocation-related-refactoring branch from 2f8a792 to f101654 Compare November 29, 2018 18:51
@codecov

This comment has been minimized.

@christianparpart christianparpart force-pushed the cp-SourceLocation-related-refactoring branch from f101654 to 77d43d4 Compare November 29, 2018 22:47
@christianparpart christianparpart changed the title [RFC] SourceLocation refactoring wrt. sourceName-vs-CharStream SourceLocation refactoring wrt. sourceName-vs-CharStream Nov 29, 2018
@christianparpart christianparpart force-pushed the cp-SourceLocation-related-refactoring branch 2 times, most recently from 2412441 to d08d3ee Compare November 30, 2018 10:04
@christianparpart christianparpart force-pushed the cp-SourceLocation-related-refactoring branch 2 times, most recently from a1bd63e to 9908c8b Compare November 30, 2018 12:27
@christianparpart christianparpart force-pushed the cp-SourceLocation-related-refactoring branch from ef61405 to b91639e Compare November 30, 2018 16:03
Christian Parpart added 3 commits November 30, 2018 17:07
…Stream source, eliminating sourceName

Also, adapted affecting code to those changes.
…arStream already)

Also, ParserBase::sourceName() was dead code. Eliminating it should
increase test coverage (how sneaky) :-)
Especially also remove SourceLocation ctor's that the compiler can default-implement.
@christianparpart christianparpart force-pushed the cp-SourceLocation-related-refactoring branch from b91639e to 18e3d6d Compare November 30, 2018 16:11
@christianparpart christianparpart changed the title SourceLocation refactoring wrt. sourceName-vs-CharStream [1/3] SourceLocation related refactoring. Nov 30, 2018
@chriseth chriseth merged commit aaeb74f into develop Nov 30, 2018
@christianparpart christianparpart deleted the cp-SourceLocation-related-refactoring branch November 30, 2018 23:17
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