1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

CModelBuilder reporting parser success to the translation unit

This commit is contained in:
Hoda Amer 2004-03-04 19:55:20 +00:00
parent 7c50719ee7
commit 32c4def642
2 changed files with 11 additions and 2 deletions

View file

@ -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 2004-03-03 Alain Magloire
When changing the BinaryParser the BinaryRunners When changing the BinaryParser the BinaryRunners

View file

@ -68,6 +68,8 @@ public class CModelBuilder {
private Map newElements; private Map newElements;
private IQuickParseCallback quickParseCallback; 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) { public CModelBuilder(org.eclipse.cdt.internal.core.model.TranslationUnit tu) {
this.translationUnit = tu ; this.translationUnit = tu ;
@ -140,7 +142,8 @@ public class CModelBuilder {
throw new ParserException( CCorePlugin.getResourceString("CModelBuilder.Parser_Construction_Failure")); //$NON-NLS-1$ throw new ParserException( CCorePlugin.getResourceString("CModelBuilder.Parser_Construction_Failure")); //$NON-NLS-1$
} }
// call parse // call parse
if( ! parser.parse() && throwExceptionOnError ) hasNoErrors = parser.parse();
if( (!hasNoErrors) && throwExceptionOnError )
throw new ParserException(CCorePlugin.getResourceString("CModelBuilder.Parse_Failure")); //$NON-NLS-1$ throw new ParserException(CCorePlugin.getResourceString("CModelBuilder.Parse_Failure")); //$NON-NLS-1$
return quickParseCallback.getCompilationUnit(); return quickParseCallback.getCompilationUnit();
} }
@ -161,6 +164,8 @@ public class CModelBuilder {
try try
{ {
generateModelElements(); generateModelElements();
// important to know if the unit has parse errors or not
translationUnit.getElementInfo().setIsStructureKnown(hasNoErrors);
} }
catch( NullPointerException npe ) catch( NullPointerException npe )
{ {