private BufferScope getBufferForReferenceSub(TableBuffer symbol) { if (!canScopeBufferReference(symbol)) return parent.getBufferForReferenceSub(symbol); return new BufferScope(this, symbol, BufferScope.Strength.REFERENCE); }
@Override public void assignAttributesLike(Primative likePrim) { dataType = likePrim.getDataType(); className = likePrim.getClassName(); extent = likePrim.getExtent(); }
/** Find or create a buffer for the input BufferSymbol */ public BufferScope getBufferForReference(TableBuffer symbol) { BufferScope buffer = getBufferScope(symbol, BufferScope.Strength.REFERENCE); if (buffer == null) buffer = getBufferForReferenceSub(symbol); // Yes, add reference to outer blocks, even if we got this buffer from // an outer block. Might have blocks in between which need the reference // to be added. addBufferScopeReferences(buffer); return buffer; } // getBufferForReference
/** Find nearest BufferScope for a BufferSymbol, if any */ private BufferScope findBufferScope(TableBuffer symbol) { for (BufferScope buff : bufferScopes) { if (buff.getSymbol() != symbol) continue; if (buff.getBlock() == this) return buff; } if (parent != null && symbol.getScope().getRootBlock() != this) return parent.findBufferScope(symbol); return null; }
/** * 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 noteReference(ContextQualifier contextQualifier) { allRefsCount++; if (ContextQualifier.isRead(contextQualifier)) numReads++; if (ContextQualifier.isWrite(contextQualifier)) numWrites++; if (ContextQualifier.isReference(contextQualifier)) numRefd++; }
/** Lookup a Widget based on TokenType (FRAME, BUTTON, etc) and the name in this scope or enclosing scope. */ public Widget lookupWidget(int widgetType, String name) { Widget ret = (Widget) lookupSymbolLocally(widgetType, name); if (ret == null && parentScope != null) return parentScope.lookupWidget(widgetType, name); return ret; }
/** * From the nearest frame scoping block, get the default (possibly unnamed) frame if it exists. Returns null if no * default frame has been established yet. */ public Frame getDefaultFrame() { if (defaultFrame != null) return defaultFrame; if (!canScopeFrame()) return parent.getDefaultFrame(); return null; }
/** * A root-block is the root block for any SymbolScope whether program, function, trigger, or internal procedure. */ public boolean isRootBlock() { return symbolScope.getRootBlock() == this; }
public TP01Support(RefactorSession session, ParseUnit unit) { this.refSession = session; this.unit = unit; this.rootScope = new TreeParserRootSymbolScope(refSession); currentScope = rootScope; }
/** Unlike other symbols, Frames are automatically added to the scope, right here at creation time. */ public Frame(String name, TreeParserSymbolScope scope) { super(name, scope); scope.add(this); }
/** Is a buffer scoped to this or any parent of this block. */ public boolean isBufferLocal(BufferScope buff) { for (Block block = this; block.parent != null; block = block.parent) { if (buff.getBlock() == block) return true; } return false; }
public Routine(String name, TreeParserSymbolScope definingScope, TreeParserSymbolScope routineScope) { super(name, definingScope); this.routineScope = routineScope; this.routineScope.setRoutine(this); }
public TreeParserRootSymbolScope getRootScope() { if (parentScope == null) { return (TreeParserRootSymbolScope) this; } else { return parentScope.getRootScope(); } }
public Symbol(String name, TreeParserSymbolScope scope, boolean parameter) { this.name = name; this.scope = scope; this.parameter = parameter; scope.addSymbol(this); }
/** * Initialize the frame and set the frame scope if not done already. Returns the frameScopeBlock. * * @see #isInitialized() */ public Block initialize(Block block) { if (initialized) return frameScopeBlock; initialized = true; if (frameScopeBlock == null) frameScopeBlock = block.addFrame(this); return frameScopeBlock; }
/** Find nearest BufferScope for a BufferSymbol, if any */ private BufferScope findBufferScope(TableBuffer symbol) { for (BufferScope buff : bufferScopes) { if (buff.getSymbol() != symbol) continue; if (buff.getBlock() == this) return buff; } if (parent != null && symbol.getScope().getRootBlock() != this) return parent.findBufferScope(symbol); return null; }
/** * 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); }
private BufferScope getBufferForReferenceSub(TableBuffer symbol) { if (!canScopeBufferReference(symbol)) return parent.getBufferForReferenceSub(symbol); return new BufferScope(this, symbol, BufferScope.Strength.REFERENCE); }
@Override public void assignAttributesLike(Primative likePrim) { dataType = likePrim.getDataType(); className = likePrim.getClassName(); extent = likePrim.getExtent(); }