-
Notifications
You must be signed in to change notification settings - Fork 593
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
Fix Metadata Warning Locations #3014
Changes from 2 commits
4812e38
65bc834
e03ffb1
aafb3ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,7 +218,7 @@ namespace Slice | |
void visitConst(const ConstPtr&) final; | ||
|
||
private: | ||
MetadataList validate(const SyntaxTreeBasePtr&, MetadataList, const std::string&, int, bool = false); | ||
MetadataList validate(const SyntaxTreeBasePtr&, MetadataList, const std::string&, bool = false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's nice to add param names when updating functions. Especially when the param names are non-obvious. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should also add a comment describing what this visitor does; presumably, validate |
||
}; | ||
|
||
static void validateMetadata(const UnitPtr&); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite follow the
file
vsmeta->file()
in this function. Are they always the same?Apparently,
file
andcont
are only used to getdc
anddc
is only used to issue warnings.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long story short, it's always safest to get the metadata's file with
meta->file()
.Most of the time, you're right that it will be the same as
file
, but there's some edge cases where they can differ:Here,
file
is the file of the actual sequence definition (File1
), but we want to issue the warning forFile2
.I think we can eliminate the need to get the
dc
with afile
in the first place, and letwarning
do the lookup using thefile
you pass into it. But obviously, we'd need to movewarning
somewhere else first.One step at a time though. If you stare at any of our code long enough, you'll find an endless pit of refactoring.