diff --git a/src/Famix-Python-Importer/FamixPythonImporter.class.st b/src/Famix-Python-Importer/FamixPythonImporter.class.st index c446b0a..86a8597 100644 --- a/src/Famix-Python-Importer/FamixPythonImporter.class.st +++ b/src/Famix-Python-Importer/FamixPythonImporter.class.st @@ -12,7 +12,8 @@ Class { #name : 'FamixPythonImporter', #superclass : 'Object', #instVars : [ - 'visitor' + 'visitor', + 'errorReport' ], #category : 'Famix-Python-Importer-Importer', #package : 'Famix-Python-Importer', @@ -26,6 +27,12 @@ FamixPythonImporter class >> import: aFileName [ import: aFileName ] +{ #category : 'accessing' } +FamixPythonImporter >> errorReport [ + + ^ visitor errorReport +] + { #category : 'api' } FamixPythonImporter >> import: aFileName [ @@ -42,6 +49,9 @@ FamixPythonImporter >> import: aFileName [ self importFileReference: fileReference. visitor solver resolveUnresolvedReferences. + + self flag: #todo. "We should probably handle it another way in production." + self errorReport ifNotEmpty: [ self errorReport inspect ]. ^ visitor model ] diff --git a/src/Famix-Python-Importer/FamixPythonImporterVisitor.class.st b/src/Famix-Python-Importer/FamixPythonImporterVisitor.class.st index a224def..2431c07 100644 --- a/src/Famix-Python-Importer/FamixPythonImporterVisitor.class.st +++ b/src/Famix-Python-Importer/FamixPythonImporterVisitor.class.st @@ -12,6 +12,19 @@ Class { #tag : 'Visitors' } +{ #category : 'visiting' } +FamixPythonImporterVisitor >> acceptNode: aNode [ + + ^ [ super acceptNode: aNode ] + on: Exception + do: [ :exception | + (exception isKindOf: Warning) + ifTrue: [ + self errorReport addWarning: exception. + exception resume ] + ifFalse: [ self errorReport addError: exception ] ] +] + { #category : 'visiting' } FamixPythonImporterVisitor >> acceptNodes: aCollection [ "override to return the result of the visits"