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
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;
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;
24
public class GCCASTSimpleDeclSpecifier extends CASTSimpleDeclSpecifier implements IGCCASTSimpleDeclSpecifier, IASTAmbiguityParent {
26
private IASTExpression typeOfExpression;
28
public GCCASTSimpleDeclSpecifier() {
31
public GCCASTSimpleDeclSpecifier(IASTExpression typeofExpression) {
32
setTypeofExpression(typeofExpression);
36
public GCCASTSimpleDeclSpecifier copy() {
37
GCCASTSimpleDeclSpecifier copy = new GCCASTSimpleDeclSpecifier();
38
copySimpleDeclSpec(copy);
39
copy.setTypeofExpression(typeOfExpression == null ? null : typeOfExpression.copy());
43
public void setTypeofExpression(IASTExpression typeofExpression) {
44
this.typeOfExpression = typeofExpression;
45
if (typeofExpression != null) {
46
typeofExpression.setParent(this);
47
typeofExpression.setPropertyInParent(TYPEOF_EXPRESSION);
51
public IASTExpression getTypeofExpression() {
52
return typeOfExpression;
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;
64
if( typeOfExpression != null )
65
if( !typeOfExpression.accept( action ) ) return false;
67
if( action.shouldVisitDeclSpecifiers ){
68
switch( action.leave( this ) ){
69
case ASTVisitor.PROCESS_ABORT : return false;
70
case ASTVisitor.PROCESS_SKIP : return true;
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;