Code review comment: Shouldn't we add a check like `matchedNode != null` too?

Code under review:
private Optional<LhsRhsSymbolInfo> getLhsAndRhsSymbolInfo(NonTerminalNode matchedNode, CodeActionContext context) {
        Optional<Symbol> rhsSymbol;
        Optional<Symbol> lhsSymbol = Optional.empty();

        Optional<TypeSymbol> rhsType;
        Optional<TypeSymbol> lhsType = Optional.empty();

        NonTerminalNode rhsNode = null;
        Node lhsNode = null;

        SemanticModel semanticModel = context.currentSemanticModel().get();
        do {
            if (matchedNode.kind() == SyntaxKind.LOCAL_VAR_DECL) {
                VariableDeclarationNode node = (VariableDeclarationNode) matchedNode;
                if (node.initializer().isPresent()) {
                    rhsNode = node.initializer().get();
                    lhsNode = node.typedBindingPattern();
                    lhsSymbol = semanticModel.symbol(lhsNode)
                            .filter(symbol -> symbol.kind() == SymbolKind.VARIABLE);
                    lhsType = lhsSymbol.map(symbol -> ((VariableSymbol) symbol).typeDescriptor());
                }
                break;
            } else if (matchedNode.kind() == SyntaxKind.ASSIGNMENT_STATEMENT) {
                
                
                
                AssignmentStatementNode assignmentStatementNode = (AssignmentStatementNode) matchedNode;
                if (assignmentStatementNode.varRef().kind() == SyntaxKind.FIELD_ACCESS) {
                    FieldAccessExpressionNode exprNode = (FieldAccessExpressionNode) assignmentStatementNode.varRef();
                    lhsNode = exprNode.fieldName();
                    lhsSymbol = semanticModel.symbol(lhsNode)
                            .filter(symbol -> symbol.kind() == SymbolKind.CLASS_FIELD
                                    || symbol.kind() == SymbolKind.RECORD_FIELD);
                    lhsType = lhsSymbol
                            .map(symbol -> symbol.kind() == SymbolKind.CLASS_FIELD ?
                                    ((ClassFieldSymbol) symbol).typeDescriptor()
                                    : ((RecordFieldSymbol) symbol).typeDescriptor());
                } else {
                    lhsNode = assignmentStatementNode.varRef();
                    lhsSymbol = semanticModel.symbol(lhsNode)
                            .filter(symbol -> symbol.kind() == SymbolKind.VARIABLE);
                    lhsType = lhsSymbol
                            .map(symbol -> ((VariableSymbol) symbol).typeDescriptor());
                }
                rhsNode = assignmentStatementNode.expression();
                break;
            } else if (matchedNode.kind() == SyntaxKind.SPECIFIC_FIELD) {
                SpecificFieldNode specificFieldNode = (SpecificFieldNode) matchedNode;
                lhsNode = specificFieldNode.fieldName();
                rhsNode = specificFieldNode.valueExpr().get();
                lhsSymbol = semanticModel.symbol(lhsNode)
                        .filter(symbol -> symbol.kind() == SymbolKind.RECORD_FIELD);
                lhsType = lhsSymbol
                        .map(symbol -> ((RecordFieldSymbol) symbol).typeDescriptor());
                break;
            }
            matchedNode = matchedNode.parent();
        } while (matchedNode.kind() != SyntaxKind.LOCAL_VAR_DECL ||
                matchedNode.kind() != SyntaxKind.ASSIGNMENT_STATEMENT
                || matchedNode.kind() != SyntaxKind.SPECIFIC_FIELD);

        if (rhsNode == null || lhsNode == null) {
            return Optional.empty();
        }

        rhsSymbol = semanticModel.symbol(rhsNode);
        rhsType = semanticModel.typeOf(rhsNode);

        if (rhsSymbol.isEmpty() || lhsSymbol.isEmpty() || lhsType.isEmpty() || rhsType.isEmpty()) {
            return Optional.empty();
        }
        LhsRhsSymbolInfo nodeInfo = new LhsRhsSymbolInfo(rhsSymbol.get(), lhsType.get(),
                rhsType.get(), rhsNode, lhsNode);
        return Optional.of(nodeInfo);
    }

Line commented on: matchedNode.kind() != SyntaxKind.ASSIGNMENT_STATEMENT

Revised code:
private Optional<LhsRhsSymbolInfo> getLhsAndRhsSymbolInfo(NonTerminalNode matchedNode, CodeActionContext context) {
        Optional<Symbol> rhsSymbol;
        Optional<Symbol> lhsSymbol = Optional.empty();

        Optional<TypeSymbol> rhsType;
        Optional<TypeSymbol> lhsType = Optional.empty();

        NonTerminalNode rhsNode = null;
        Node lhsNode = null;

        SemanticModel semanticModel = context.currentSemanticModel().get();
        do {
            if (matchedNode.kind() == SyntaxKind.LOCAL_VAR_DECL) {
                VariableDeclarationNode node = (VariableDeclarationNode) matchedNode;
                if (node.initializer().isPresent()) {
                    rhsNode = node.initializer().get();
                    lhsNode = node.typedBindingPattern();
                    lhsSymbol = semanticModel.symbol(lhsNode)
                            .filter(symbol -> symbol.kind() == SymbolKind.VARIABLE);
                    lhsType = lhsSymbol.map(symbol -> ((VariableSymbol) symbol).typeDescriptor());
                }
                break;
            } else if (matchedNode.kind() == SyntaxKind.ASSIGNMENT_STATEMENT) {
                
                
                
                AssignmentStatementNode assignmentStatementNode = (AssignmentStatementNode) matchedNode;
                if (assignmentStatementNode.varRef().kind() == SyntaxKind.FIELD_ACCESS) {
                    FieldAccessExpressionNode exprNode = (FieldAccessExpressionNode) assignmentStatementNode.varRef();
                    lhsNode = exprNode.fieldName();
                    lhsSymbol = semanticModel.symbol(lhsNode)
                            .filter(symbol -> symbol.kind() == SymbolKind.CLASS_FIELD
                                    || symbol.kind() == SymbolKind.RECORD_FIELD);
                    lhsType = lhsSymbol
                            .map(symbol -> symbol.kind() == SymbolKind.CLASS_FIELD ?
                                    ((ClassFieldSymbol) symbol).typeDescriptor()
                                    : ((RecordFieldSymbol) symbol).typeDescriptor());
                } else {
                    lhsNode = assignmentStatementNode.varRef();
                    lhsSymbol = semanticModel.symbol(lhsNode)
                            .filter(symbol -> symbol.kind() == SymbolKind.VARIABLE);
                    lhsType = lhsSymbol
                            .map(symbol -> ((VariableSymbol) symbol).typeDescriptor());
                }
                rhsNode = assignmentStatementNode.expression();
                break;
            } else if (matchedNode.kind() == SyntaxKind.SPECIFIC_FIELD) {
                SpecificFieldNode specificFieldNode = (SpecificFieldNode) matchedNode;
                lhsNode = specificFieldNode.fieldName();
                rhsNode = specificFieldNode.valueExpr().get();
                lhsSymbol = semanticModel.symbol(lhsNode)
                        .filter(symbol -> symbol.kind() == SymbolKind.RECORD_FIELD);
                lhsType = lhsSymbol
                        .map(symbol -> ((RecordFieldSymbol) symbol).typeDescriptor());
                break;
            }
            matchedNode = matchedNode.parent();
        } while (matchedNode != null && (matchedNode.kind() == SyntaxKind.LOCAL_VAR_DECL 
                || matchedNode.kind() == SyntaxKind.ASSIGNMENT_STATEMENT
                || matchedNode.kind() == SyntaxKind.SPECIFIC_FIELD));

        if (matchedNode == null || rhsNode == null || lhsNode == null) {
            return Optional.empty();
        }

        rhsSymbol = semanticModel.symbol(rhsNode);
        rhsType = semanticModel.typeOf(rhsNode);

        if (rhsSymbol.isEmpty() || lhsSymbol.isEmpty() || lhsType.isEmpty() || rhsType.isEmpty()) {
            return Optional.empty();
        }
        LhsRhsSymbolInfo nodeInfo = new LhsRhsSymbolInfo(rhsSymbol.get(), lhsType.get(),
                rhsType.get(), rhsNode, lhsNode);
        return Optional.of(nodeInfo);
    }