-
Notifications
You must be signed in to change notification settings - Fork 2
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
FEDX-2227: Fixed logic for constructor references #165
Conversation
@@ -95,7 +95,7 @@ | |||
// ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# | |||
// ^^^^^ definition local 5 | |||
Foo(1, value: true, value2: ''); | |||
// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo# | |||
// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#`<constructor>`(). |
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.
Now we're correctly referencing <constructor>
, fixed by: https://github.com/Workiva/scip-dart/pull/165/files#diff-0ab533d80a9e11da530798d9b92364a97087c4754ab8251de00d85b635c6a4e4R76
@@ -77,6 +76,13 @@ | |||
} | |||
} | |||
|
|||
factory Animal.cat() => Animal('Timmy', type: AnimalType.cat); |
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.
Very frustratingly, in named constructors, Animal.cat()
there is only a single identifier
This isn't the case for SimpleIdentifiers for the call sight, but only the constructor declarations
The result of this, is we can only index a single element here, and I've decided to index, the arguably more important, definition for cat()
factory Animal.cat() => ...
// ^^^^^^ NOT INDEXED
// ^^^ definition ... Animal#cat().
Solving this is a problem for another day...
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 created a ticket to track this here: #166
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.
Two comment nits, otherwise LGTM
lib/src/symbol_generator.dart
Outdated
@@ -44,6 +44,38 @@ class SymbolGenerator { | |||
} else if (node is SimpleIdentifier) { | |||
var element = node.staticElement; | |||
|
|||
// A SimpleIdentifier with a direct parent of a ConstructorDeclaration | |||
// is the reference to the class itself. In scip, we want to ignore | |||
// this as the constructor has its own definition, and only that |
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.
Is there a missing end of sentence here?
lib/src/symbol_generator.dart
Outdated
if (parentConstructor != null) { | ||
// ConstructorNames can also include an import PrefixIdentifier: `math.Rectangle()` | ||
// both 'math' and 'Rectangle' are SimpleIdentifiers. We only want the constructor | ||
// element fo 'Rectangle' in this case |
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.
spelling nit: 'fo'
Going to close and re-open this, trying to fix one of the CI errors. |
QA +1
🚀 @Workiva/release-management-p 🚢 |
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.
+1 from RM
FEDX-2227
Closes #164
Closes #163