~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to results/plugins/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPLabel.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*******************************************************************************
2
 
 * Copyright (c) 2004, 2009 IBM Corporation and others.
3
 
 * All rights reserved. This program and the accompanying materials
4
 
 * are made available under the terms of the Eclipse Public License v1.0
5
 
 * which accompanies this distribution, and is available at
6
 
 * http://www.eclipse.org/legal/epl-v10.html
7
 
 *
8
 
 * Contributors:
9
 
 *     IBM Corporation - initial API and implementation
10
 
 *     Markus Schorn (Wind River Systems)
11
 
 *******************************************************************************/
12
 
package org.eclipse.cdt.internal.core.dom.parser.cpp;
13
 
 
14
 
import org.eclipse.cdt.core.dom.ILinkage;
15
 
import org.eclipse.cdt.core.dom.ast.DOMException;
16
 
import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
17
 
import org.eclipse.cdt.core.dom.ast.IASTName;
18
 
import org.eclipse.cdt.core.dom.ast.IASTNode;
19
 
import org.eclipse.cdt.core.dom.ast.IBinding;
20
 
import org.eclipse.cdt.core.dom.ast.ILabel;
21
 
import org.eclipse.cdt.core.dom.ast.IScope;
22
 
import org.eclipse.cdt.internal.core.dom.Linkage;
23
 
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
24
 
import org.eclipse.core.runtime.PlatformObject;
25
 
 
26
 
/**
27
 
 * @author aniefer
28
 
 */
29
 
public class CPPLabel extends PlatformObject implements ILabel, ICPPInternalBinding {
30
 
    private IASTName statement;
31
 
 
32
 
    public CPPLabel( IASTName statement ) {
33
 
        this.statement = statement;
34
 
        statement.setBinding( this );
35
 
    }
36
 
 
37
 
    public IASTNode[] getDeclarations() {
38
 
        return null;
39
 
    }
40
 
 
41
 
    public IASTNode getDefinition() {
42
 
        return statement;
43
 
    }
44
 
 
45
 
    public IASTLabelStatement getLabelStatement() {
46
 
        if( statement instanceof IASTLabelStatement )
47
 
            return (IASTLabelStatement) statement;
48
 
        
49
 
        // TODO find label statement
50
 
        return null;
51
 
    }
52
 
 
53
 
    public String getName() {
54
 
        return new String(getNameCharArray());
55
 
    }
56
 
 
57
 
    public char[] getNameCharArray() {
58
 
        return statement.getSimpleID();
59
 
    }
60
 
 
61
 
    public IScope getScope() {
62
 
        return CPPVisitor.getContainingScope( statement );
63
 
    }
64
 
 
65
 
    public IASTNode getPhysicalNode() {
66
 
        return statement;
67
 
    }
68
 
 
69
 
 
70
 
    public void setLabelStatement( IASTName labelStatement ) {
71
 
        statement = labelStatement;
72
 
    }
73
 
 
74
 
    public String[] getQualifiedName() {
75
 
        return new String[] { getName() };
76
 
    }
77
 
 
78
 
    public char[][] getQualifiedNameCharArray() {
79
 
        return new char [] [] { getNameCharArray() };
80
 
    }
81
 
    
82
 
    public boolean isGloballyQualified() {
83
 
        return false;
84
 
    }
85
 
 
86
 
        public void addDefinition(IASTNode node) {
87
 
        }
88
 
 
89
 
        public void addDeclaration(IASTNode node) {
90
 
        }
91
 
 
92
 
        public ILinkage getLinkage() {
93
 
                return Linkage.CPP_LINKAGE;
94
 
        }
95
 
 
96
 
        public IBinding getOwner() throws DOMException {
97
 
                return CPPVisitor.findEnclosingFunction(statement);
98
 
        }
99
 
}