From 32c4def64215be97599191632c1472ec47bc5f6f Mon Sep 17 00:00:00 2001 From: Hoda Amer Date: Thu, 4 Mar 2004 19:55:20 +0000 Subject: [PATCH] CModelBuilder reporting parser success to the translation unit --- core/org.eclipse.cdt.core/ChangeLog | 4 ++++ .../eclipse/cdt/internal/core/model/CModelBuilder.java | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index a5b1cf0bad6..7bf0a27a4f8 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -1,3 +1,7 @@ +2004-03-04 Hoda Amer + The CModelBuilder is reporting to the TranslationUnit + whether parsing was successful or not. + 2004-03-03 Alain Magloire When changing the BinaryParser the BinaryRunners diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java index 7de3ceea4a8..f33d6758cc0 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java @@ -67,7 +67,9 @@ public class CModelBuilder { private org.eclipse.cdt.internal.core.model.TranslationUnit translationUnit; private Map newElements; private IQuickParseCallback quickParseCallback; - private IASTCompilationUnit compilationUnit; + private IASTCompilationUnit compilationUnit; + // indicator if the unit has parse errors + private boolean hasNoErrors = false; public CModelBuilder(org.eclipse.cdt.internal.core.model.TranslationUnit tu) { this.translationUnit = tu ; @@ -140,7 +142,8 @@ public class CModelBuilder { throw new ParserException( CCorePlugin.getResourceString("CModelBuilder.Parser_Construction_Failure")); //$NON-NLS-1$ } // call parse - if( ! parser.parse() && throwExceptionOnError ) + hasNoErrors = parser.parse(); + if( (!hasNoErrors) && throwExceptionOnError ) throw new ParserException(CCorePlugin.getResourceString("CModelBuilder.Parse_Failure")); //$NON-NLS-1$ return quickParseCallback.getCompilationUnit(); } @@ -161,6 +164,8 @@ public class CModelBuilder { try { generateModelElements(); + // important to know if the unit has parse errors or not + translationUnit.getElementInfo().setIsStructureKnown(hasNoErrors); } catch( NullPointerException npe ) {