Skip to content

Conversation

matthewnitschke-wk
Copy link
Contributor

@matthewnitschke-wk matthewnitschke-wk commented Jul 8, 2024

There are 2 parts to getting a symbol representation of a dart reference/definition: selecting the correct Element based on a provided AstNode, and building the string using that selected element

Before this PR, the element selection part was done directly within the scip_visitor, which is not exported from scip-dart. This PR moves all of this logic to the symbol_generator, which is exported and available

The SymbolGenerator was selected as the elementFor method is a necessary step in symbol generation. It seemed like a fitting, and convenient place (due to the pre-existing exporting of the class)

Also, unrelated, but closes #37 and closes #120

@aviary3-wk
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

@matthewnitschke-wk matthewnitschke-wk changed the title localized element selection logic to the symbol generator Localized element selection logic to the SymbolGenerator Jul 8, 2024
offset: node.name.offset,
length: node.name.length,
);
return;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes #120

@matthewnitschke-wk matthewnitschke-wk marked this pull request as ready for review July 8, 2024 15:40
Comment on lines +47 to +49
print(AnimalType.values);
// ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print().
// ^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/AnimalType#
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This validates the case in #37, don't index .values

// ^^^^ reference local 0
required this.value,
// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value.
// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#`<constructor>`().(value)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

named parameters are indexed as both references and definitions, this is due to the case mentioned in #120, where they are goto'd from a declaration side of things

Comment on lines +71 to +76
// The values field on enums is synthetic, and has no explicit definition like
// other fields do. Skip indexing for this case.
if (element.enclosingElement is EnumElement &&
element.name == 'values') {
return null;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the part that closes #37

@matthewnitschke-wk matthewnitschke-wk changed the title Localized element selection logic to the SymbolGenerator FEDX-1213: Localized element selection logic to the SymbolGenerator Jul 9, 2024
Copy link

@dustinlessard-wf dustinlessard-wf left a comment

Choose a reason for hiding this comment

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

Just curious: This codebase doesn't appear to have tests. Is there a reason for that?

@matthewnitschke-wk
Copy link
Contributor Author

QA +1

  • Validated snapshot generation, and other CI passes

🚀 @Workiva/release-management-p 🚢

Copy link

@rmconsole-wf rmconsole-wf left a comment

Choose a reason for hiding this comment

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

+1 from RM

@rmconsole5-wk rmconsole5-wk merged commit cc62ed7 into master Jul 9, 2024
@rmconsole5-wk rmconsole5-wk deleted the localized_element_selection_logic_to_symbol_generator branch July 9, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Constructor formal parameters not creating reference References to enum's values symbol are not indexed
5 participants