summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Corbat2012-05-30 08:32:17 (EDT)
committer Sergey Prigogin2012-06-26 23:03:56 (EDT)
commitf8bad556272908811b6cebef4e3076e47a06d08c (patch)
tree0f84265a55730c61c326c5a1e875640095e2ea47
parent3a63a3c793f888c744014b6b5d5d6195e6adeb15 (diff)
downloadorg.eclipse.cdt-f8bad556272908811b6cebef4e3076e47a06d08c.zip
org.eclipse.cdt-f8bad556272908811b6cebef4e3076e47a06d08c.tar.gz
org.eclipse.cdt-f8bad556272908811b6cebef4e3076e47a06d08c.tar.bz2
Bug 381032 - NameWriter extended for fully qualified names.
Extended the NameWriter for allowing ASTWriter to write fully qualified names correctly with a leading scope (::). Added one simple test to verify this functionality. Cosmetic fix: Formatting adapted to environment and removed superfluous trailing tabs. Change-Id: I7eec92666d49a93b47a1906a75169dd42ba41eb1 Reviewed-on: https://git.eclipse.org/r/6170 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterNameTestSource.awts4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java3
2 files changed, 7 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterNameTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterNameTestSource.awts
index 9117bb4..935db70 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterNameTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterNameTestSource.awts
@@ -6,6 +6,10 @@ int Hallo;
//%CPP
int TestClass::Hallo;
+//!FullyQualifiedName
+//%CPP
+int ::name;
+
//!OperatorName
//%CPP
class Foo
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java
index 610f86a..90e0e71 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java
@@ -118,6 +118,9 @@ public class NameWriter extends NodeWriter {
}
private void writeQualifiedName(ICPPASTQualifiedName qname) {
+ if (qname.isFullyQualified()) {
+ scribe.print(COLON_COLON);
+ }
IASTName[] nodes = qname.getNames();
for (int i = 0; i < nodes.length; ++i) {
nodes[i].accept(visitor);