Skip to content

Commit

Permalink
cleaned up ast
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewnitschke-wk committed Apr 13, 2023
1 parent 88f559e commit 55b7bcc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/src/scip_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ class ScipVisitor extends GeneralizingAstVisitor {
void _visitSimpleIdentifier(SimpleIdentifier node) {
var element = node.staticElement;

// [element] for assignment fields is null. If the parent node
// is a `CompoundAssignmentExpression`, we know this node is referring
// to an assignment line. In that case, use the read/write element attached
// to this node instead of the [node]'s element
if (node.parent is CompoundAssignmentExpression) {
final assignmentNode = node.parent as CompoundAssignmentExpression;
element = assignmentNode.readElement ?? assignmentNode.writeElement;
} else if (node.parent?.parent is AssignmentExpression) {
final assignment = node.parent!.parent as AssignmentExpression;
element = assignment.readElement ?? assignment.writeElement;
}

// When the identifier is a field, the analyzer creates synthetic getters/
Expand Down

0 comments on commit 55b7bcc

Please sign in to comment.