public void pushScope(boolean bInitialInstanceMethodScope) { if (_scopes == null) { _scopes = new Stack<IRScope>(); } IRScope parent = _scopes.isEmpty() ? null : _scopes.peek(); _scopes.push(new IRScope(parent)); if (bInitialInstanceMethodScope) { assert parent == null; _scopes.peek().addSymbol(Keyword.KW_this.getName(), _context.getIRTypeForCurrentClass()); } }
public IRSymbol getSymbol(String symbolName) { IRSymbol symbol = _scopes.peek().getSymbol(symbolName); if (symbol == null) { throw new IllegalStateException("No symbol found named " + symbolName); } return symbol; }
public IRSymbol makeAndIndexTempSymbol(String strNameSuffix, IRType type) { String strName = strNameSuffix != null ? TEMP_VAR_PREFIX + strNameSuffix : TEMP_VAR_PREFIX + _tempVarCount++; IRSymbol symbol = new IRSymbol(strName, type, true); _scopes.peek().addSymbol(symbol); return symbol; }
public IRSymbol getTypeParamIndex(TypeVariableType type) { return _scopes .peek() .getSymbol(AbstractElementTransformer.TYPE_PARAM_PREFIX + type.getRelativeName()); }
public void popScope() { _scopes.pop(); }
public IRSymbol createSymbol(String name, IRType type) { return _scopes.peek().addSymbol(name, type); }
public void putSymbol(IRSymbol symbol) { _scopes.peek().addSymbol(symbol); }
public boolean hasSymbol(String symbolName) { return _scopes.peek().getSymbol(symbolName) != null; }