@Override public void programTail() throws SemanticException { LOG.trace("Entering programTail"); // Now that we know what all the internal Routines are, wrap up the Calls. List<TreeParserSymbolScope> allScopes = new ArrayList<>(); allScopes.add(rootScope); allScopes.addAll(rootScope.getChildScopesDeep()); LinkedList<Call> calls = new LinkedList<>(); for (TreeParserSymbolScope scope : allScopes) { for (Call call : scope.getCallList()) { // Process IN HANDLE last to make sure PERSISTENT SET is processed first. if (call.isInHandle()) { calls.addLast(call); } else { calls.addFirst(call); } } } for (Call call : calls) { String routineId = call.getRunArgument(); call.wrapUp(rootScope.hasRoutine(routineId)); } }
public TP01Support(RefactorSession session, ParseUnit unit) { this.refSession = session; this.unit = unit; this.rootScope = new TreeParserRootSymbolScope(refSession); currentScope = rootScope; }
/** Get or create the unnamed buffer for a schema table. */ public TableBuffer getUnnamedBuffer(ITable table) { assert table.getStoretype() == IConstants.ST_DBTABLE; // Check this and parents for the unnamed buffer. Table triggers // can scope an unnamed buffer - that's why we don't go straight to // the root scope. TreeParserSymbolScope nextScope = this; while (nextScope != null) { TableBuffer buffer = nextScope.unnamedBuffers.get(table); if (buffer != null) return buffer; nextScope = nextScope.parentScope; } return getRootScope().defineBuffer("", table); }
IField field; result = new FieldLookupResult(); field = symbolScope.getRootScope().lookupUnqualifiedField(name); if (field != null) { tableBuff = symbolScope.getRootScope().getLocalTableBuffer(field.getTable()); } else { field = symbolScope.getRootScope().getRefactorSession().getSchema().lookupUnqualifiedField(name); if (field == null) return null;
String clsName = rootScope.getClassName(); if ((clsRef != null) && (clsName != null) && (clsRef.indexOf('.') == -1) && (clsName.indexOf('.') != -1)) clsName = clsName.substring(clsName.indexOf('.') + 1);
@Override public void programRoot(JPNode rootAST) { LOG.trace("Entering programRoot {}", rootAST); BlockNode blockNode = (BlockNode) rootAST; currentBlock = pushBlock(new Block(rootScope, blockNode)); rootScope.setRootBlock(currentBlock); blockNode.setBlock(currentBlock); getParseUnit().setRootScope(rootScope); Routine r = new Routine("", rootScope, rootScope); r.setProgressType(ProParserTokenTypes.Program_root); r.setDefOrIdNode(blockNode); blockNode.setSymbol(r); rootScope.add(r); currentRoutine = r; rootRoutine = r; }
int numFuncs = 0; int numMethds = 0; for (TreeParserSymbolScope child : unit.getRootScope().getChildScopesDeep()) { int scopeType = child.getRootBlock().getNode().getType(); switch (scopeType) {
/** * Add a TableBuffer for names lookup. This is called when copying a SymbolScopeSuper's symbols for inheritance * purposes. */ private void add(TableBuffer tableBuffer) { ITable table = tableBuffer.getTable(); addTableBuffer(tableBuffer.getName(), table, tableBuffer); getRootScope().addTableDefinitionIfNew(table); }
@Override public void defineTableLike(JPNode tableAST) { LOG.trace("Entering defineTableLike {}", tableAST); // Get table for "LIKE table" ITable table = astTableLink(tableAST); currDefTableLike = table; // For each field in "table", create a field def in currDefTable for (IField field : table.getFieldPosOrder()) { rootScope.defineTableField(field.getName(), currDefTable).assignAttributesLike(field); } }
public void defineTable(JPNode defNode, JPNode idNode, int storeType) { LOG.trace("Entering defineTable {} {} {}", defNode, idNode, storeType); TableBuffer buffer = rootScope.defineTable(idNode.getText(), storeType); buffer.setDefOrIdNode(defNode); currSymbol = buffer; currDefTable = buffer; currDefTableLike = null; currDefTableUseIndex = false; idNode.setLink(IConstants.SYMBOL, buffer); }
/** * Defining a table field is done in two steps. The first step creates the field and field buffer but does not assign * the field to the table yet. The second step assigns the field to the table. We don't want the field assigned to the * table until we're done examining the field options, because we don't want the field available for lookup due to * situations like this: def temp-table tt1 field DependentCare like DependentCare. * * @return The Object that is expected to be passed as an argument to defineTableFieldFinalize. * @see #defineTableFieldFinalize(Object) */ @Override public Symbol defineTableFieldInitialize(JPNode idNode) { LOG.trace("Entering defineTableFieldInitialize {}", idNode); FieldBuffer fieldBuff = rootScope.defineTableFieldDelayedAttach(idNode.getText(), currDefTable); currSymbol = fieldBuff; fieldBuff.setDefOrIdNode(idNode); idNode.setLink(IConstants.SYMBOL, fieldBuff); return fieldBuff; }
IField field; result = new FieldLookupResult.Builder(); field = symbolScope.getRootScope().lookupUnqualifiedField(name); if (field != null) { tableBuff = symbolScope.getRootScope().getLocalTableBuffer(field.getTable()); } else { field = symbolScope.getRootScope().getRefactorSession().getSchema().lookupUnqualifiedField(name); if (field == null) return null;
String clsName = rootScope.getClassName(); if ((clsRef != null) && (clsName != null) && (clsRef.indexOf('.') == -1) && (clsName.indexOf('.') != -1)) clsName = clsName.substring(clsName.indexOf('.') + 1);
@Override public void programRoot(JPNode rootAST) { LOG.trace("Entering programRoot {}", rootAST); BlockNode blockNode = (BlockNode) rootAST; currentBlock = pushBlock(new Block(rootScope, blockNode)); rootScope.setRootBlock(currentBlock); blockNode.setBlock(currentBlock); getParseUnit().setRootScope(rootScope); Routine r = new Routine("", rootScope, rootScope); r.setProgressType(ProParserTokenTypes.Program_root); r.setDefOrIdNode(blockNode); blockNode.setSymbol(r); rootScope.add(r); currentRoutine = r; rootRoutine = r; }
/** * Add a TableBuffer for names lookup. This is called when copying a SymbolScopeSuper's symbols for inheritance * purposes. */ private void add(TableBuffer tableBuffer) { ITable table = tableBuffer.getTable(); addTableBuffer(tableBuffer.getName(), table, tableBuffer); getRootScope().addTableDefinitionIfNew(table); }
@Override public void defineTableLike(JPNode tableAST) { LOG.trace("Entering defineTableLike {}", tableAST); // Get table for "LIKE table" ITable table = astTableLink(tableAST); currDefTableLike = table; // For each field in "table", create a field def in currDefTable for (IField field : table.getFieldPosOrder()) { rootScope.defineTableField(field.getName(), currDefTable).assignAttributesLike(field); } }
public void defineTable(JPNode defNode, JPNode idNode, int storeType) { LOG.trace("Entering defineTable {} {} {}", defNode, idNode, storeType); TableBuffer buffer = rootScope.defineTable(idNode.getText(), storeType); buffer.setDefOrIdNode(defNode); currSymbol = buffer; currDefTable = buffer; currDefTableLike = null; currDefTableUseIndex = false; idNode.setLink(IConstants.SYMBOL, buffer); }
/** * Defining a table field is done in two steps. The first step creates the field and field buffer but does not assign * the field to the table yet. The second step assigns the field to the table. We don't want the field assigned to the * table until we're done examining the field options, because we don't want the field available for lookup due to * situations like this: def temp-table tt1 field DependentCare like DependentCare. * * @return The Object that is expected to be passed as an argument to defineTableFieldFinalize. * @see #defineTableFieldFinalize(Object) */ @Override public Symbol defineTableFieldInitialize(JPNode idNode) { LOG.trace("Entering defineTableFieldInitialize {}", idNode); FieldBuffer fieldBuff = rootScope.defineTableFieldDelayedAttach(idNode.getText(), currDefTable); currSymbol = fieldBuff; fieldBuff.setDefOrIdNode(idNode); idNode.setLink(IConstants.SYMBOL, fieldBuff); return fieldBuff; }
@Override public void programTail() throws SemanticException { LOG.trace("Entering programTail"); // Now that we know what all the internal Routines are, wrap up the Calls. List<TreeParserSymbolScope> allScopes = new ArrayList<>(); allScopes.add(rootScope); allScopes.addAll(rootScope.getChildScopesDeep()); LinkedList<Call> calls = new LinkedList<>(); for (TreeParserSymbolScope scope : allScopes) { for (Call call : scope.getCallList()) { // Process IN HANDLE last to make sure PERSISTENT SET is processed first. if (call.isInHandle()) { calls.addLast(call); } else { calls.addFirst(call); } } } for (Call call : calls) { String routineId = call.getRunArgument(); call.wrapUp(rootScope.hasRoutine(routineId)); } }
unit.attachXref(doc); unit.attachTransactionBlocks(trxBlocks); unit.attachTypeInfo(session.getTypeInfo(unit.getRootScope().getClassName())); updateParseTime(System.currentTimeMillis() - startTime); } catch (UncheckedIOException caught) {