Skip to content

Commit

Permalink
[element model] migrate valid_regexps
Browse files Browse the repository at this point in the history
Bug: dart-lang/linter#5099
Change-Id: I447de40607f9ef4fd49b80c406b75285b28839f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387604
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
  • Loading branch information
pq authored and Commit Queue committed Sep 30, 2024
1 parent 76d5d2a commit a4dcd25
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/linter/lib/src/rules/valid_regexps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ class _Visitor extends SimpleAstVisitor<void> {

@override
void visitInstanceCreationExpression(InstanceCreationExpression node) {
var element = node.constructorName.staticElement?.enclosingElement3;
if (element?.name == 'RegExp' && element?.library.name == 'dart.core') {
var element = node.constructorName.element?.enclosingElement2;
if (element == null) return;

if (element.name == 'RegExp' && (element.library2?.isDartCore ?? false)) {
var args = node.argumentList.arguments;
if (args.isEmpty) {
return;
}
if (args.isEmpty) return;

bool isTrue(Expression e) => e is BooleanLiteral && e.value;

Expand Down

0 comments on commit a4dcd25

Please sign in to comment.