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

« back to all changes in this revision

Viewing changes to core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleNodeHelper.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2013-10-03 20:30:16 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20131003203016-d4ug6l0xgosasumq
Tags: 8.2.1-1
* New upstream release.
* Updated autotools documentation sources.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*******************************************************************************
2
 
 * Copyright (c) 2011 Institute for Software, HSR Hochschule fuer Technik  
 
2
 * Copyright (c) 2011, 2013 Institute for Software, HSR Hochschule fuer Technik  
3
3
 * Rapperswil, University of applied sciences and others.
4
4
 * All rights reserved. This program and the accompanying materials 
5
5
 * are made available under the terms of the Eclipse Public License v1.0 
7
7
 * http://www.eclipse.org/legal/epl-v10.html  
8
8
 * 
9
9
 * Contributors: 
10
 
 *     Martin Schwab & Thomas Kallenberg - initial API and implementation 
 
10
 *     Martin Schwab & Thomas Kallenberg - initial API and implementation
 
11
 *     Marc-Andre Laperle (Ericsson)
11
12
 ******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.refactoring.togglefunction;
13
14
 
180
181
        static IASTFunctionDefinition createInClassDefinition(IASTFunctionDeclarator dec, 
181
182
                        IASTFunctionDefinition def, IASTTranslationUnit insertionAst) {
182
183
                IASTFunctionDeclarator declarator = dec.copy(CopyStyle.withLocations);
183
 
                ICPPASTDeclSpecifier declSpec =
184
 
                                (ICPPASTDeclSpecifier) def.getDeclSpecifier().copy(CopyStyle.withLocations);
 
184
                IASTDeclSpecifier declSpec =
 
185
                                def.getDeclSpecifier().copy(CopyStyle.withLocations);
185
186
                declSpec.setInline(false);
186
 
                if (ToggleNodeHelper.isVirtual(dec)) {
187
 
                        declSpec.setVirtual(true);
 
187
                if (declSpec instanceof ICPPASTDeclSpecifier && ToggleNodeHelper.isVirtual(dec)) {
 
188
                        ((ICPPASTDeclSpecifier) declSpec).setVirtual(true);
188
189
                }
189
190
                declSpec.setStorageClass(getStorageClass(dec));
190
191
                
202
203
        static int getStorageClass(IASTFunctionDeclarator fdec) {
203
204
                if (fdec.getParent() instanceof IASTSimpleDeclaration) {
204
205
                        IASTSimpleDeclaration dec = (IASTSimpleDeclaration) fdec.getParent();
205
 
                        return ((ICPPASTDeclSpecifier) dec.getDeclSpecifier()).getStorageClass();
 
206
                        return dec.getDeclSpecifier().getStorageClass();
206
207
                }
207
208
                return -1;
208
209
        }