From 63ffe8d9591cd2e77af9d83a18c79bdb8a99fe39 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Wed, 26 Jan 2005 16:07:13 +0000 Subject: [PATCH] Fixed name bug for macro names. --- .../cdt/core/parser/tests/ast2/DOMLocationTests.java | 5 ++++- .../cdt/internal/core/parser/scanner2/LocationMap.java | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMLocationTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMLocationTests.java index 5de013abbfd..fd8f0368eac 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMLocationTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMLocationTests.java @@ -101,9 +101,12 @@ public class DOMLocationTests extends AST2BaseTest { assertNotNull( macros ); assertEquals( macros.length, 1 ); assertSoleLocation( macros[0], code.indexOf( "#"), code.indexOf( "0x01") + 4 - code.indexOf( "#")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals( macros[0].getName().toString(), "FOOT" ); //$NON-NLS-1$ + assertEquals( macros[0].getExpansion(), "0x01"); //$NON-NLS-1$ } - } + + /** * @param declarator * @param offset diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java index a976cee5c7f..a2104ad9edc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java @@ -186,6 +186,13 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog { public char[] toCharArray() { return name; } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + public String toString() { + return new String( name ); + } } /** * @author jcamelon