Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2010-02-17 11:23:57 -0500
committerMarkus Schorn2010-02-17 11:23:57 -0500
commit1fc47b91e1471210836462a9c55328fa494c00b1 (patch)
tree489f37caa31ca12ceb085c6723c80a0f1e756496 /core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter
parent608c4287b45a669ecc363e112c1deb651d936b66 (diff)
downloadorg.eclipse.cdt-1fc47b91e1471210836462a9c55328fa494c00b1.tar.gz
org.eclipse.cdt-1fc47b91e1471210836462a9c55328fa494c00b1.tar.xz
org.eclipse.cdt-1fc47b91e1471210836462a9c55328fa494c00b1.zip
Bug 302412: Syntax for c++0x initializer lists
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/InitializerWriter.java27
2 files changed, 18 insertions, 18 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
index 7538010132..ce5714b5aa 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008, 2010 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -27,7 +27,6 @@ import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPointerToMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
@@ -81,9 +80,6 @@ public class DeclaratorWriter extends NodeWriter {
name.accept(visitor);
IASTInitializer init = getInitializer(declarator);
if(init!= null) {
- if (! (init instanceof ICPPASTConstructorInitializer)) {
- scribe.print(EQUALS);
- }
init.accept(visitor);
}
}
@@ -109,7 +105,6 @@ public class DeclaratorWriter extends NodeWriter {
private void writeInitializer(IASTStandardFunctionDeclarator funcDec) {
IASTInitializer init = getInitializer(funcDec);
if(init != null) {
- scribe.print(EQUALS);
init.accept(visitor);
}
}
@@ -219,7 +214,6 @@ public class DeclaratorWriter extends NodeWriter {
writeArrayModifiers(arrDecl, arrMods);
IASTInitializer initializer = getInitializer(arrDecl);
if(initializer != null) {
- scribe.print(EQUALS);
initializer.accept(visitor);
}
}
@@ -253,7 +247,6 @@ public class DeclaratorWriter extends NodeWriter {
fieldDecl.getBitFieldSize().accept(visitor);
IASTInitializer initializer = getInitializer(fieldDecl);
if(initializer != null) {
- scribe.print(EQUALS);
initializer.accept(visitor);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/InitializerWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/InitializerWriter.java
index 33ad9d12aa..6f3c8f2d40 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/InitializerWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/InitializerWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008, 2010 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -12,8 +12,9 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
+import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
-import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
+import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator;
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer;
@@ -43,8 +44,8 @@ public class InitializerWriter extends NodeWriter{
}
protected void writeInitializer(IASTInitializer initializer) {
- if (initializer instanceof IASTInitializerExpression) {
- ((IASTInitializerExpression) initializer).getExpression().accept(visitor);
+ if (initializer instanceof IASTEqualsInitializer) {
+ writeEqualsInitializer((IASTEqualsInitializer) initializer);
}else if (initializer instanceof IASTInitializerList) {
writeInitializerList((IASTInitializerList) initializer);
}else if (initializer instanceof ICPPASTConstructorInitializer) {
@@ -59,23 +60,29 @@ public class InitializerWriter extends NodeWriter{
}
+ private void writeEqualsInitializer(IASTEqualsInitializer initializer) {
+ scribe.print(EQUALS);
+ IASTInitializerClause init = initializer.getInitializerClause();
+ if (init != null) {
+ init.accept(visitor);
+ }
+ }
+
private void writeConstructorChainInitializer(ICPPASTConstructorChainInitializer initializer) {
initializer.getMemberInitializerId().accept(visitor);
- scribe.print('(');
- initializer.getInitializerValue().accept(visitor);
- scribe.print(')');
+ initializer.getInitializer().accept(visitor);
}
private void writeInitializerList(IASTInitializerList initList) {
scribe.printLBrace();
- IASTInitializer[] inits = initList.getInitializers();
+ IASTInitializerClause[] inits = initList.getClauses();
writeNodeList(inits);
scribe.printRBrace();
}
private void writeConstructorInitializer(ICPPASTConstructorInitializer ctorInit) {
scribe.print('(');
- ctorInit.getExpression().accept(visitor);
+ writeNodeList(ctorInit.getArguments());
scribe.print(')');
}
@@ -85,7 +92,7 @@ public class InitializerWriter extends NodeWriter{
writeDesignator(designator);
}
scribe.print(EQUALS);
- desigInit.getOperandInitializer().accept(visitor);
+ desigInit.getOperand().accept(visitor);
}
private void writeDesignator(ICASTDesignator designator) {

Back to the top