Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM drydock-prod.workiva.net/workiva/dart_build_image:3 as build
Copy link
Contributor Author

Choose a reason for hiding this comment

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

leftover from previous release process, now that scip-dart is published to pub.dev, publishing will be done manually (until we can figure out how to automate it)

FROM scratch
9 changes: 9 additions & 0 deletions lib/src/scip_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ class ScipVisitor extends GeneralizingAstVisitor {
void _visitSimpleIdentifier(SimpleIdentifier node) {
var element = node.staticElement;

// Both `.loadLibrary()`, and `.call()` are synthetic functions that
// have no definition. These should therefore should not be indexed.
Copy link
Member

Choose a reason for hiding this comment

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

#nit

Suggested change
// have no definition. These should therefore should not be indexed.
// have no definition. Therefore these should not be indexed.

if (element is FunctionElement && element.isSynthetic) {
if ([
FunctionElement.LOAD_LIBRARY_NAME,
FunctionElement.CALL_METHOD_NAME,
Comment on lines +91 to +92

Choose a reason for hiding this comment

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

I don't suppose the analyzer provides their own list of synthetic functions without definitions? :badpokerface:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately not

I pulled this directly from the analyzer code here: https://sourcegraph.com/github.com/dart-lang/sdk/-/blob/pkg/analyzer/lib/src/dart/analysis/index.dart?L145:27. There's also no references of LOAD_LIBRARY_NAME

].contains(element.name)) return;
}

// [element] for assignment fields is null. If the parent node
// is a `CompoundAssignmentExpression`, we know this node is referring
// to an assignment line. In that case, use the read/write element attached
Expand Down
8 changes: 8 additions & 0 deletions snapshots/input/basic-project/lib/other.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'more.dart' deferred as more;

class Foo {
int _far;
Foo(this._far);
Expand All @@ -11,4 +13,10 @@ class Bar {
_someValue = 'asdf';
print(_someValue);
}
}

void main() {
more.loadLibrary().then((_) => {
Bar('a').someMethod.call()
});
}
20 changes: 19 additions & 1 deletion snapshots/output/basic-project/lib/other.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
class Foo {
import 'more.dart' deferred as more;
// definition scip-dart pub dart_test 1.0.0 lib/other.dart/
// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/other.dart/more.
// documentation ```dart

class Foo {
// ^^^ definition scip-dart pub dart_test 1.0.0 lib/other.dart/Foo#
// documentation ```dart
int _far;
Expand Down Expand Up @@ -40,3 +44,17 @@
// ^^^^^^^^^^ reference local 2
}
}

void main() {
// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/other.dart/main().
// documentation ```dart
more.loadLibrary().then((_) => {
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/other.dart/more.
// ^^^^ reference scip-dart pub dart:async 2.18.0 dart:async/future.dart/Future#then().
Comment on lines +52 to +53
Copy link
Contributor Author

Choose a reason for hiding this comment

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

loadLibrary has no scip reference, as it has no definition

// ^ definition local 4
// documentation ```dart
Bar('a').someMethod.call()
// ^^^ reference scip-dart pub dart_test 1.0.0 lib/other.dart/Bar#
// ^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/other.dart/Bar#someMethod().
Comment on lines +57 to +58
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similarly, call has no reference, as it has no definition

});
}