Skip to content
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

FEA-3206: Fix NormalFormalParameters #111

Merged
merged 7 commits into from
Feb 1, 2024
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
5 changes: 3 additions & 2 deletions lib/src/scip_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
56 changes: 27 additions & 29 deletions snapshots/output/basic-project/lib/more.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@
Animal(this.name, {required this.type}) {
// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#`<constructor>`().
// ^^^^^^ 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#`<constructor>`().(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:
Expand Down Expand Up @@ -98,67 +96,67 @@
// ^^^^^^^^^^^^ 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
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the local variable changes here are just due to no longer declaring local 0 above, no cause for concern

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() {
// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/main().
List<int> 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#`<constructor>`().(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#`<constructor>`().(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().
Expand All @@ -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
29 changes: 12 additions & 17 deletions snapshots/output/basic-project/lib/other.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@
// ^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#`<constructor>`().
// ^^^ 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#`<constructor>`().(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#`<constructor>`().(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#`<constructor>`().(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().
Expand All @@ -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#`<constructor>`().
// ^^^ 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
}
}

Expand All @@ -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().
Expand All @@ -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#`<constructor>`().(value)
Expand All @@ -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
}
Loading