Skip to content

Commit 317211f

Browse files
Merge pull request #111 from Workiva/fix_formal_parameters
FEA-3206: Fix NormalFormalParameters
2 parents f6f7ca7 + 3887257 commit 317211f

File tree

3 files changed

+42
-48
lines changed

3 files changed

+42
-48
lines changed

lib/src/scip_visitor.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ class ScipVisitor extends GeneralizingAstVisitor {
9292
_registerAsReference(
9393
fieldElement!,
9494
node,
95-
offset: node.thisKeyword.offset,
96-
length: node.thisKeyword.length,
95+
offset: node.name.offset,
96+
length: node.name.length,
9797
);
98+
return;
9899
}
99100

100101
_registerAsDefinition(element, node);

snapshots/output/basic-project/lib/more.dart

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@
4141
Animal(this.name, {required this.type}) {
4242
// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#`<constructor>`().
4343
// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#
44-
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#name.
45-
// ^^^^ definition local 0
46-
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#type.
47-
// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#`<constructor>`().(type)
44+
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#name.
45+
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#type.
4846
switch (type) {
4947
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#type.
5048
case AnimalType.cat:
@@ -98,67 +96,67 @@
9896
// ^^^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/calculateSum().
9997
// ^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`list.dart`/List#
10098
// ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int#
101-
// ^^^^^^^ definition local 1
99+
// ^^^^^^^ definition local 0
102100
return numbers.reduce((value, element) => value + element);
103-
// ^^^^^^^ reference local 1
101+
// ^^^^^^^ reference local 0
104102
// ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`iterable.dart`/Iterable#reduce().
105-
// ^^^^^ definition local 2
106-
// ^^^^^^^ definition local 3
107-
// ^^^^^ reference local 2
108-
// ^^^^^^^ reference local 3
103+
// ^^^^^ definition local 1
104+
// ^^^^^^^ definition local 2
105+
// ^^^^^ reference local 1
106+
// ^^^^^^^ reference local 2
109107
}
110108

111109
void main() {
112110
// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/main().
113111
List<int> numbers = [1, 2, 3, 4, 5];
114112
// ^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`list.dart`/List#
115113
// ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int#
116-
// ^^^^^^^ definition local 4
114+
// ^^^^^^^ definition local 3
117115
int sum = calculateSum(numbers);
118116
// ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int#
119-
// ^^^ definition local 5
117+
// ^^^ definition local 4
120118
// ^^^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/calculateSum().
121-
// ^^^^^^^ reference local 4
119+
// ^^^^^^^ reference local 3
122120

123121
Animal cat = Animal('Kitty', type: AnimalType.cat);
124122
// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#
125-
// ^^^ definition local 6
123+
// ^^^ definition local 5
126124
// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#
127125
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#`<constructor>`().(type)
128126
// ^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/AnimalType#
129127
// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/AnimalType#cat.
130128
Animal dog = Animal('Buddy', type: AnimalType.dog);
131129
// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#
132-
// ^^^ definition local 7
130+
// ^^^ definition local 6
133131
// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#
134132
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#`<constructor>`().(type)
135133
// ^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/AnimalType#
136134
// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/AnimalType#dog.
137135

138136
cat.makeSound();
139-
// ^^^ reference local 6
137+
// ^^^ reference local 5
140138
// ^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#makeSound().
141139
cat.sleep();
142-
// ^^^ reference local 6
140+
// ^^^ reference local 5
143141
// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/SleepMixin#sleep().
144142

145143
dog.makeSound();
146-
// ^^^ reference local 7
144+
// ^^^ reference local 6
147145
// ^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/Animal#makeSound().
148146
dog.sleep();
149-
// ^^^ reference local 7
147+
// ^^^ reference local 6
150148
// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/SleepMixin#sleep().
151149

152150
print(cat);
153151
// ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print().
154-
// ^^^ reference local 6
152+
// ^^^ reference local 5
155153
print(dog);
156154
// ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print().
157-
// ^^^ reference local 7
155+
// ^^^ reference local 6
158156
print('The sum of $numbers is $sum');
159157
// ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print().
160-
// ^^^^^^^ reference local 4
161-
// ^^^ reference local 5
158+
// ^^^^^^^ reference local 3
159+
// ^^^ reference local 4
162160

163161
print(math.Rectangle(1,2,3,4));
164162
// ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print().
@@ -167,19 +165,19 @@
167165

168166
[1,2].reduce((a, b) => a + b);
169167
// ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`iterable.dart`/Iterable#reduce().
170-
// ^ definition local 8
171-
// ^ definition local 9
172-
// ^ reference local 8
173-
// ^ reference local 9
168+
// ^ definition local 7
169+
// ^ definition local 8
170+
// ^ reference local 7
171+
// ^ reference local 8
174172
}
175173

176174
void test(String Function(int) p) {}
177175
// ^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/test().
178176
// ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String#
179177
// ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int#
180-
// ^ definition local 10
178+
// ^ definition local 9
181179
void deepTest(String Function(void Function(String test)) p) {}
182180
// ^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`more.dart`/deepTest().
183181
// ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String#
184182
// ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String#
185-
// ^ definition local 11
183+
// ^ definition local 10

snapshots/output/basic-project/lib/other.dart

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,13 @@
2020
// ^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#`<constructor>`().
2121
// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#
2222
this._far, {
23-
// ^^^^ reference local 0
24-
// ^^^^ definition local 1
23+
// ^^^^ reference local 0
2524
required this.value,
26-
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value.
27-
// ^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#`<constructor>`().(value)
25+
// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value.
2826
required this.value2,
29-
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value2.
30-
// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#`<constructor>`().(value2)
27+
// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value2.
3128
this.value3,
32-
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value3.
33-
// ^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#`<constructor>`().(value3)
29+
// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value3.
3430
}) {
3531
print(_far);
3632
// ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print().
@@ -42,20 +38,19 @@
4238
// ^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Bar#
4339
String _someValue;
4440
// ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String#
45-
// ^^^^^^^^^^ definition local 2
41+
// ^^^^^^^^^^ definition local 1
4642
Bar(this._someValue);
4743
// ^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Bar#`<constructor>`().
4844
// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Bar#
49-
// ^^^^ reference local 2
50-
// ^^^^^^^^^^ definition local 3
45+
// ^^^^^^^^^^ reference local 1
5146

5247
void someMethod() {
5348
// ^^^^^^^^^^ definition scip-dart pub dart_test 1.0.0 lib/`other.dart`/Bar#someMethod().
5449
_someValue = 'asdf';
55-
// ^^^^^^^^^^ reference local 2
50+
// ^^^^^^^^^^ reference local 1
5651
print(_someValue);
5752
// ^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`print.dart`/print().
58-
// ^^^^^^^^^^ reference local 2
53+
// ^^^^^^^^^^ reference local 1
5954
}
6055
}
6156

@@ -64,7 +59,7 @@
6459
more.loadLibrary().then((_) => {
6560
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/more.
6661
// ^^^^ reference scip-dart pub dart:async 2.19.0 dart:async/`future.dart`/Future#then().
67-
// ^ definition local 4
62+
// ^ definition local 2
6863
Bar('a').someMethod.call()
6964
// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Bar#
7065
// ^^^^^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Bar#someMethod().
@@ -77,7 +72,7 @@
7772
// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value.
7873

7974
final someStr = 'someStr';
80-
// ^^^^^^^ definition local 5
75+
// ^^^^^^^ definition local 3
8176
Foo(2, value: false, value2: 'some Val!')
8277
// ^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#
8378
// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#`<constructor>`().(value)
@@ -86,12 +81,12 @@
8681
// ^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value.
8782
..value2 = someStr
8883
// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value2.
89-
// ^^^^^^^ reference local 5
84+
// ^^^^^^^ reference local 3
9085
..value3 = 2.15;
9186
// ^^^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/Foo#value3.
9287

9388
more.test((_) => 'val');
9489
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`other.dart`/more.
9590
// ^^^^ reference scip-dart pub dart_test 1.0.0 lib/`more.dart`/test().
96-
// ^ definition local 6
91+
// ^ definition local 4
9792
}

0 commit comments

Comments
 (0)