diff --git a/lib/src/scip_visitor.dart b/lib/src/scip_visitor.dart index fe0e021b..8d0fb2e0 100644 --- a/lib/src/scip_visitor.dart +++ b/lib/src/scip_visitor.dart @@ -92,9 +92,10 @@ class ScipVisitor extends GeneralizingAstVisitor { _registerAsReference( fieldElement!, node, - offset: node.thisKeyword.offset, - length: node.thisKeyword.length, + offset: node.name.offset, + length: node.name.length, ); + return; } _registerAsDefinition(element, node); diff --git a/snapshots/output/basic-project/lib/more.dart b/snapshots/output/basic-project/lib/more.dart index 68773981..4b8c8894 100755 --- a/snapshots/output/basic-project/lib/more.dart +++ b/snapshots/output/basic-project/lib/more.dart @@ -41,10 +41,8 @@ Animal(this.name, {required this.type}) { // ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#``(). // ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal# -// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#name. -// ^^^^ definition local 0 -// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#type. -// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#``().(type) +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#name. +// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#type. switch (type) { // ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#type. case AnimalType.cat: @@ -98,14 +96,14 @@ // ^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/calculateSum(). // ^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`list.dart`/List# // ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# -// ^^^^^^^ definition local 1 +// ^^^^^^^ definition local 0 return numbers.reduce((value, element) => value + element); -// ^^^^^^^ reference local 1 +// ^^^^^^^ reference local 0 // ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`iterable.dart`/Iterable#reduce(). -// ^^^^^ definition local 2 -// ^^^^^^^ definition local 3 -// ^^^^^ reference local 2 -// ^^^^^^^ reference local 3 +// ^^^^^ definition local 1 +// ^^^^^^^ definition local 2 +// ^^^^^ reference local 1 +// ^^^^^^^ reference local 2 } void main() { @@ -113,52 +111,52 @@ List numbers = [1, 2, 3, 4, 5]; // ^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`list.dart`/List# // ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# -// ^^^^^^^ definition local 4 +// ^^^^^^^ definition local 3 int sum = calculateSum(numbers); // ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# -// ^^^ definition local 5 +// ^^^ definition local 4 // ^^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/calculateSum(). -// ^^^^^^^ reference local 4 +// ^^^^^^^ reference local 3 Animal cat = Animal('Kitty', type: AnimalType.cat); // ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal# -// ^^^ definition local 6 +// ^^^ definition local 5 // ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal# // ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#``().(type) // ^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/AnimalType# // ^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/AnimalType#cat. Animal dog = Animal('Buddy', type: AnimalType.dog); // ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal# -// ^^^ definition local 7 +// ^^^ definition local 6 // ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal# // ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#``().(type) // ^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/AnimalType# // ^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/AnimalType#dog. cat.makeSound(); -// ^^^ reference local 6 +// ^^^ reference local 5 // ^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#makeSound(). cat.sleep(); -// ^^^ reference local 6 +// ^^^ reference local 5 // ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/SleepMixin#sleep(). dog.makeSound(); -// ^^^ reference local 7 +// ^^^ reference local 6 // ^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#makeSound(). dog.sleep(); -// ^^^ reference local 7 +// ^^^ reference local 6 // ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/SleepMixin#sleep(). print(cat); // ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print(). -// ^^^ reference local 6 +// ^^^ reference local 5 print(dog); // ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print(). -// ^^^ reference local 7 +// ^^^ reference local 6 print('The sum of $numbers is $sum'); // ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print(). -// ^^^^^^^ reference local 4 -// ^^^ reference local 5 +// ^^^^^^^ reference local 3 +// ^^^ reference local 4 print(math.Rectangle(1,2,3,4)); // ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print(). @@ -167,19 +165,19 @@ [1,2].reduce((a, b) => a + b); // ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`iterable.dart`/Iterable#reduce(). -// ^ definition local 8 -// ^ definition local 9 -// ^ reference local 8 -// ^ reference local 9 +// ^ definition local 7 +// ^ definition local 8 +// ^ reference local 7 +// ^ reference local 8 } void test(String Function(int) p) {} // ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/test(). // ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# // ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# -// ^ definition local 10 +// ^ definition local 9 void deepTest(String Function(void Function(String test)) p) {} // ^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/deepTest(). // ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# // ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# -// ^ definition local 11 +// ^ definition local 10 diff --git a/snapshots/output/basic-project/lib/other.dart b/snapshots/output/basic-project/lib/other.dart index ef81825b..8bd2eef0 100755 --- a/snapshots/output/basic-project/lib/other.dart +++ b/snapshots/output/basic-project/lib/other.dart @@ -20,17 +20,13 @@ // ^^^ definition 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# this._far, { -// ^^^^ reference local 0 -// ^^^^ definition local 1 +// ^^^^ 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#``().(value) +// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value. required this.value2, -// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value2. -// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#``().(value2) +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value2. this.value3, -// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value3. -// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#``().(value3) +// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value3. }) { print(_far); // ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print(). @@ -42,20 +38,19 @@ // ^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Bar# String _someValue; // ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# -// ^^^^^^^^^^ definition local 2 +// ^^^^^^^^^^ definition local 1 Bar(this._someValue); // ^^^ definition 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# -// ^^^^ reference local 2 -// ^^^^^^^^^^ definition local 3 +// ^^^^^^^^^^ reference local 1 void someMethod() { // ^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Bar#someMethod(). _someValue = 'asdf'; -// ^^^^^^^^^^ reference local 2 +// ^^^^^^^^^^ reference local 1 print(_someValue); // ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print(). -// ^^^^^^^^^^ reference local 2 +// ^^^^^^^^^^ reference local 1 } } @@ -64,7 +59,7 @@ more.loadLibrary().then((_) => { // ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/more. // ^^^^ reference scip-dart pub dart:async 2.19.0 dart:async/`future.dart`/Future#then(). -// ^ definition local 4 +// ^ definition local 2 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(). @@ -77,7 +72,7 @@ // ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value. final someStr = 'someStr'; -// ^^^^^^^ definition local 5 +// ^^^^^^^ definition local 3 Foo(2, value: false, value2: 'some Val!') // ^^^ 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#``().(value) @@ -86,12 +81,12 @@ // ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value. ..value2 = someStr // ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value2. -// ^^^^^^^ reference local 5 +// ^^^^^^^ reference local 3 ..value3 = 2.15; // ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value3. more.test((_) => 'val'); // ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/more. // ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/test(). -// ^ definition local 6 +// ^ definition local 4 }