~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/c/GCCASTSimpleDeclSpecifier.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) 2005, 2008 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
 
 *     Emanuel Graf IFS - Bugfix for #198257
11
 
 *******************************************************************************/
12
 
package org.eclipse.cdt.internal.core.dom.parser.c;
13
 
 
14
 
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
15
 
import org.eclipse.cdt.core.dom.ast.IASTExpression;
16
 
import org.eclipse.cdt.core.dom.ast.IASTNode;
17
 
import org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTSimpleDeclSpecifier;
18
 
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
19
 
 
20
 
/**
21
 
 * @author aniefer
22
 
 *
23
 
 */
24
 
public class GCCASTSimpleDeclSpecifier extends CASTSimpleDeclSpecifier implements IGCCASTSimpleDeclSpecifier, IASTAmbiguityParent {
25
 
 
26
 
        private IASTExpression typeOfExpression;
27
 
 
28
 
        public GCCASTSimpleDeclSpecifier() {
29
 
        }
30
 
 
31
 
        public GCCASTSimpleDeclSpecifier(IASTExpression typeofExpression) {
32
 
                setTypeofExpression(typeofExpression);
33
 
        }
34
 
 
35
 
        @Override
36
 
        public GCCASTSimpleDeclSpecifier copy() {
37
 
                GCCASTSimpleDeclSpecifier copy = new GCCASTSimpleDeclSpecifier();
38
 
                copySimpleDeclSpec(copy);
39
 
                copy.setTypeofExpression(typeOfExpression == null ? null : typeOfExpression.copy());
40
 
                return copy;
41
 
        }
42
 
        
43
 
        public void setTypeofExpression(IASTExpression typeofExpression) {
44
 
                this.typeOfExpression = typeofExpression;
45
 
                if (typeofExpression != null) {
46
 
                        typeofExpression.setParent(this);
47
 
                        typeofExpression.setPropertyInParent(TYPEOF_EXPRESSION);
48
 
                }
49
 
        }
50
 
 
51
 
        public IASTExpression getTypeofExpression() {
52
 
                return typeOfExpression;
53
 
        }
54
 
 
55
 
    @Override
56
 
        public boolean accept( ASTVisitor action ){
57
 
        if( action.shouldVisitDeclSpecifiers ){
58
 
                    switch( action.visit( this ) ){
59
 
                    case ASTVisitor.PROCESS_ABORT : return false;
60
 
                    case ASTVisitor.PROCESS_SKIP  : return true;
61
 
                    default : break;
62
 
                }
63
 
                }
64
 
                if( typeOfExpression != null )
65
 
                        if( !typeOfExpression.accept( action ) ) return false;
66
 
                
67
 
                if( action.shouldVisitDeclSpecifiers ){
68
 
                        switch( action.leave( this ) ){
69
 
                        case ASTVisitor.PROCESS_ABORT : return false;
70
 
                        case ASTVisitor.PROCESS_SKIP  : return true;
71
 
                        default : break;
72
 
                        }
73
 
                }
74
 
 
75
 
                return true;
76
 
    }
77
 
    
78
 
        public void replace(IASTNode child, IASTNode other) {
79
 
        if (child == typeOfExpression) {
80
 
            other.setPropertyInParent(child.getPropertyInParent());
81
 
            other.setParent(child.getParent());
82
 
            typeOfExpression= (IASTExpression) other;
83
 
        }
84
 
        }
85
 
}