X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Feclipse%2Fjdt%2Finternal%2Fcompiler%2Fast%2FBlock.java;fp=src%2Forg%2Feclipse%2Fjdt%2Finternal%2Fcompiler%2Fast%2FBlock.java;h=0000000000000000000000000000000000000000;hb=6f0cd02d46e011bd5599e1b7fefc6159cb811135;hp=f9170be8903ed9d408da91ae82b612048de12c01;hpb=622d0e5a4b1b35b6918a516a79a0cc22272a919e;p=org.ibex.tool.git diff --git a/src/org/eclipse/jdt/internal/compiler/ast/Block.java b/src/org/eclipse/jdt/internal/compiler/ast/Block.java deleted file mode 100644 index f9170be..0000000 --- a/src/org/eclipse/jdt/internal/compiler/ast/Block.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jdt.internal.compiler.ast; - -import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; - -public class Block extends Statement { - - public Statement[] statements; - public int explicitDeclarations; - // the number of explicit declaration , used to create scope - public BlockScope scope; - - public Block(int explicitDeclarations) { - this.explicitDeclarations = explicitDeclarations; - } - - public FlowInfo analyseCode( - BlockScope currentScope, - FlowContext flowContext, - FlowInfo flowInfo) { - - // empty block - if (statements == null) return flowInfo; - boolean didAlreadyComplain = false; - for (int i = 0, max = statements.length; i < max; i++) { - Statement stat = statements[i]; - if (!stat.complainIfUnreachable(flowInfo, scope, didAlreadyComplain)) { - flowInfo = stat.analyseCode(scope, flowContext, flowInfo); - } else { - didAlreadyComplain = true; - } - } - return flowInfo; - } - /** - * Code generation for a block - */ - public void generateCode(BlockScope currentScope, CodeStream codeStream) { - - if ((bits & IsReachableMASK) == 0) { - return; - } - int pc = codeStream.position; - if (statements != null) { - for (int i = 0, max = statements.length; i < max; i++) { - statements[i].generateCode(scope, codeStream); - } - } // for local variable debug attributes - if (scope != currentScope) { // was really associated with its own scope - codeStream.exitUserScope(scope); - } - codeStream.recordPositionsFrom(pc, this.sourceStart); - } - - public boolean isEmptyBlock() { - - return statements == null; - } - - public StringBuffer printBody(int indent, StringBuffer output) { - - if (this.statements == null) return output; - for (int i = 0; i < statements.length; i++) { - statements[i].printStatement(indent + 1, output); - output.append('\n'); - } - return output; - } - - public StringBuffer printStatement(int indent, StringBuffer output) { - - printIndent(indent, output); - output.append("{\n"); //$NON-NLS-1$ - printBody(indent, output); - return printIndent(indent, output).append('}'); - } - - public void resolve(BlockScope upperScope) { - - if ((this.bits & UndocumentedEmptyBlockMASK) != 0) { - upperScope.problemReporter().undocumentedEmptyBlock(this.sourceStart, this.sourceEnd); - } - if (statements != null) { - scope = - explicitDeclarations == 0 - ? upperScope - : new BlockScope(upperScope, explicitDeclarations); - for (int i = 0, length = statements.length; i < length; i++) { - statements[i].resolve(scope); - } - } - } - - public void resolveUsing(BlockScope givenScope) { - - if ((this.bits & UndocumentedEmptyBlockMASK) != 0) { - givenScope.problemReporter().undocumentedEmptyBlock(this.sourceStart, this.sourceEnd); - } - // this optimized resolve(...) is sent only on none empty blocks - scope = givenScope; - if (statements != null) { - for (int i = 0, length = statements.length; i < length; i++) { - statements[i].resolve(scope); - } - } - } - - public void traverse( - ASTVisitor visitor, - BlockScope blockScope) { - - if (visitor.visit(this, blockScope)) { - if (statements != null) { - for (int i = 0, length = statements.length; i < length; i++) - statements[i].traverse(visitor, scope); - } - } - visitor.endVisit(this, blockScope); - } - - /** - * Dispatch the call on its last statement. - */ - public void branchChainTo(Label label) { - if (this.statements != null) { - this.statements[statements.length - 1].branchChainTo(label); - } - } - -}