@Override public void visit(BLangBlockStmt blockNode) { SymbolEnv blockEnv = SymbolEnv.createBlockEnv(blockNode, symbolEnv); // Reset the previous node to null this.setPreviousNode(null); List<BLangStatement> statements = blockNode.stmts.stream() .filter(bLangStatement -> !CommonUtil.isWorkerDereivative(bLangStatement)) .collect(Collectors.toList()); statements.sort(new CommonUtil.BLangNodeComparator()); if (statements.isEmpty() && CompletionVisitorUtil .isCursorWithinBlock((DiagnosticPos) (this.blockOwnerStack.peek()).getPosition(), blockEnv, this.lsContext, this)) { return; } this.blockStmtStack.push(blockNode); this.cursorPositionResolver = BlockStatementScopeResolver.class; blockNode.stmts.forEach(stmt -> this.acceptNode(stmt, blockEnv)); this.blockStmtStack.pop(); }
switch (node.getKind()) { case FUNCTION: if (((BLangFunction) node).markdownDocumentationAttachment == null) {
BLangNode node, BSymbol bSymbol) { Node recordNode = treeVisitor.getBlockOwnerStack().peek(); if (!recordNode.getKind().equals(NodeKind.RECORD_TYPE)) { return false;
BLangObjectTypeNode bLangService = (BLangObjectTypeNode) treeVisitor.getBlockOwnerStack().peek(); DiagnosticPos serviceNodePos = CommonUtil.toZeroBasedPosition(bLangService.getPosition()); DiagnosticPos nodePos = CommonUtil.toZeroBasedPosition((DiagnosticPos) node.getPosition()); List<BLangFunction> serviceFunctions = bLangService.getFunctions(); List<BLangSimpleVariable> serviceFields = bLangService.getFields().stream()
private int getBlockOwnerECol(Node blockOwner, BLangBlockStmt bLangBlockStmt) { if (blockOwner == null) { // When the else node is evaluating, block owner is null and the block statement only present // This is because, else node is represented with a blocks statement only return CommonUtil.toZeroBasedPosition(bLangBlockStmt.getPosition()).getEndColumn(); } else { return CommonUtil.toZeroBasedPosition((DiagnosticPos) blockOwner.getPosition()).getEndColumn(); } }
private int getBlockOwnerELine(Node blockOwner, BLangBlockStmt bLangBlockStmt) { if (blockOwner == null) { // When the else node is evaluating, block owner is null and the block statement only present // This is because, else node is represented with a blocks statement only return CommonUtil.toZeroBasedPosition(bLangBlockStmt.getPosition()).getEndLine(); } else if (blockOwner instanceof BLangTransaction) { return this.getTransactionBlockComponentEndLine((BLangTransaction) blockOwner, bLangBlockStmt); } else { return CommonUtil.toZeroBasedPosition((DiagnosticPos) blockOwner.getPosition()).getEndLine(); } }