Skip to content

Commit

Permalink
regen snaps
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewnitschke-wk committed Sep 28, 2023
1 parent 9988a0d commit c1a887e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
9 changes: 9 additions & 0 deletions lib/src/scip_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class ScipVisitor extends GeneralizingAstVisitor {
_visitTypeAnnotation(node);
} else if (node is ImportPrefixReference) {
_visitImportPrefixReference(node);
} else if (node is DeclaredVariablePattern) {
_visitPatternField(node);
}

super.visitNode(node);
Expand Down Expand Up @@ -176,6 +178,13 @@ class ScipVisitor extends GeneralizingAstVisitor {
);
}

void _visitPatternField(DeclaredVariablePattern node) {
final element = node.declaredElement;
if (element == null) return;

_registerAsDefinition(element);
}

/// Registers the provided [element] as a reference to an existing definition
///
/// [node] refers to the ast node where the reference exists, [element]
Expand Down
3 changes: 3 additions & 0 deletions snapshots/input/staging-project/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dart.sdkPath": "~/.asdf/installs/dart/3.1.0/dart-sdk"
}
2 changes: 1 addition & 1 deletion snapshots/input/staging-project/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# See https://dart.dev/tools/pub/glossary#lockfile
packages: {}
sdks:
dart: ">=2.18.0 <4.0.0"
dart: ">=3.0.0 <4.0.0"
2 changes: 1 addition & 1 deletion snapshots/input/staging-project/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: dart_test
version: 1.0.0

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"
6 changes: 6 additions & 0 deletions snapshots/output/dart3-features/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@
var (
String name,
// ^^^^^^ reference scip-dart pub dart:core 3.1.0 dart:core/string.dart/String#
// ^^^^ definition local 12
// documentation ```dart
int height,
// ^^^ reference scip-dart pub dart:core 3.1.0 dart:core/int.dart/int#
// ^^^^^^ definition local 13
// documentation ```dart
) = userInfo({'name': 'Michael', 'height': 180});
// ^^^^^^^^ reference scip-dart pub dart3_features 1.0.0 lib/main.dart/userInfo().
print('User $name is $height cm tall.');
Expand All @@ -138,6 +142,8 @@
if (json case {'name': 'Michael', 'height': int h}) {
// ^^^^ reference local 14
// ^^^ reference scip-dart pub dart:core 3.1.0 dart:core/int.dart/int#
// ^ definition local 15
// documentation ```dart
print('Michael is $h cm tall.');
// ^^^^^ reference scip-dart pub dart:core 3.1.0 dart:core/print.dart/print().
// ^ reference local 15
Expand Down

0 comments on commit c1a887e

Please sign in to comment.