1 /*******************************************************************************
2 * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v0.5
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v05.html
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
14 import net.sourceforge.phpdt.internal.compiler.impl.*;
15 import net.sourceforge.phpdt.internal.compiler.codegen.*;
16 import net.sourceforge.phpdt.internal.compiler.flow.*;
17 import net.sourceforge.phpdt.internal.compiler.lookup.*;
19 public class DefaultCase extends Statement {
21 public CaseLabel targetLabel;
23 * DefautCase constructor comment.
25 public DefaultCase(int sourceEnd, int sourceStart) {
27 this.sourceStart = sourceStart;
28 this.sourceEnd = sourceEnd;
31 public FlowInfo analyseCode(
32 BlockScope currentScope,
33 FlowContext flowContext,
40 * Default case code generation
42 * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
43 * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
45 public void generateCode(BlockScope currentScope, CodeStream codeStream) {
47 if ((bits & IsReachableMASK) == 0) {
50 int pc = codeStream.position;
52 codeStream.recordPositionsFrom(pc, this.sourceStart);
55 public Constant resolveCase(
58 SwitchStatement switchStatement) {
60 // remember the default case into the associated switch statement
61 if (switchStatement.defaultCase != null)
62 scope.problemReporter().duplicateDefaultCase(this);
64 // on error the last default will be the selected one .... (why not) ....
65 switchStatement.defaultCase = this;
70 public String toString(int tab) {
72 String s = tabString(tab);
73 s = s + "default : "; //$NON-NLS-1$
78 IAbstractSyntaxTreeVisitor visitor,
79 BlockScope blockScope) {
81 visitor.visit(this, blockScope);
82 visitor.endVisit(this, blockScope);