1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpeclipse.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
14 import net.sourceforge.phpdt.internal.compiler.codegen.CaseLabel;
15 import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
16 import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
17 import net.sourceforge.phpdt.internal.compiler.impl.Constant;
18 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
19 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
22 public class DefaultCase extends Statement {
24 public CaseLabel targetLabel;
26 * DefautCase constructor comment.
28 public DefaultCase(int sourceEnd, int sourceStart) {
30 this.sourceStart = sourceStart;
31 this.sourceEnd = sourceEnd;
34 public FlowInfo analyseCode(
35 BlockScope currentScope,
36 FlowContext flowContext,
43 * Default case code generation
45 * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
46 * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
48 // public void generateCode(BlockScope currentScope, CodeStream codeStream) {
50 // if ((bits & IsReachableMASK) == 0) {
53 // int pc = codeStream.position;
54 // targetLabel.place();
55 // codeStream.recordPositionsFrom(pc, this.sourceStart);
59 * No-op : should use resolveCase(...) instead.
61 public void resolve(BlockScope scope) {
64 public Constant resolveCase(
67 SwitchStatement switchStatement) {
69 // remember the default case into the associated switch statement
70 if (switchStatement.defaultCase != null)
71 scope.problemReporter().duplicateDefaultCase(this);
73 // on error the last default will be the selected one .... (why not) ....
74 switchStatement.defaultCase = this;
79 public String toString(int tab) {
81 String s = tabString(tab);
82 s = s + "default : "; //$NON-NLS-1$
87 IAbstractSyntaxTreeVisitor visitor,
88 BlockScope blockScope) {
90 visitor.visit(this, blockScope);
91 visitor.endVisit(this, blockScope);