From 23f5513f6bb9d9260c1a3f54e6d4fbbdb28c2d8a Mon Sep 17 00:00:00 2001 From: anquetil Date: Sat, 15 Jun 2024 10:13:40 +0200 Subject: [PATCH] Created FamixF77UnkownVariable --- .../FamixF77ImportingContext.class.st | 14 ++++++ .../FamixF77PUComment.class.st | 7 +++ .../FamixF77TEntityCreator.trait.st | 14 ++++++ .../FamixF77UnknownVariable.class.st | 43 +++++++++++++++++++ .../FamixFortran77Generator.class.st | 14 ++++-- 5 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 src/Famix-Fortran77-Entities/FamixF77UnknownVariable.class.st diff --git a/src/Famix-Fortran77-Entities/FamixF77ImportingContext.class.st b/src/Famix-Fortran77-Entities/FamixF77ImportingContext.class.st index 09d911e..29eefb8 100644 --- a/src/Famix-Fortran77-Entities/FamixF77ImportingContext.class.st +++ b/src/Famix-Fortran77-Entities/FamixF77ImportingContext.class.st @@ -169,6 +169,13 @@ FamixF77ImportingContext >> importTypeUnknown [ ^ self importConcreteEntity: (self class fm3ClassNamed: #TypeUnknown) ] +{ #category : #importing } +FamixF77ImportingContext >> importUnknownVariable [ + + + ^ self importConcreteEntity: (self class fm3ClassNamed: #UnknownVariable) +] + { #category : #importing } FamixF77ImportingContext >> importVariable [ @@ -330,6 +337,13 @@ FamixF77ImportingContext >> shouldImportTypeUnknown [ ^ self shouldImport: #TypeUnknown ] +{ #category : #testing } +FamixF77ImportingContext >> shouldImportUnknownVariable [ + + + ^ self shouldImport: #UnknownVariable +] + { #category : #testing } FamixF77ImportingContext >> shouldImportVariable [ diff --git a/src/Famix-Fortran77-Entities/FamixF77PUComment.class.st b/src/Famix-Fortran77-Entities/FamixF77PUComment.class.st index edb87d2..305acd9 100644 --- a/src/Famix-Fortran77-Entities/FamixF77PUComment.class.st +++ b/src/Famix-Fortran77-Entities/FamixF77PUComment.class.st @@ -34,3 +34,10 @@ FamixF77PUComment class >> annotation [ ^ self ] + +{ #category : #'as yet unclassified' } +FamixF77PUComment >> resolveVariable: variableName with: resolver [ + "PUComment should not exist, a Comment is not a ProgramUnit :-(" + + ^nil +] diff --git a/src/Famix-Fortran77-Entities/FamixF77TEntityCreator.trait.st b/src/Famix-Fortran77-Entities/FamixF77TEntityCreator.trait.st index 855f9cf..186b0a4 100644 --- a/src/Famix-Fortran77-Entities/FamixF77TEntityCreator.trait.st +++ b/src/Famix-Fortran77-Entities/FamixF77TEntityCreator.trait.st @@ -186,6 +186,20 @@ FamixF77TEntityCreator >> newTypeUnknown [ ^ self add: FamixF77TypeUnknown new ] +{ #category : #'entity creation' } +FamixF77TEntityCreator >> newUnknownVariable [ + + + ^ self add: FamixF77UnknownVariable new +] + +{ #category : #'entity creation' } +FamixF77TEntityCreator >> newUnknownVariableNamed: aName [ + + + ^ self add: (FamixF77UnknownVariable named: aName) +] + { #category : #'entity creation' } FamixF77TEntityCreator >> newVariable [ diff --git a/src/Famix-Fortran77-Entities/FamixF77UnknownVariable.class.st b/src/Famix-Fortran77-Entities/FamixF77UnknownVariable.class.st new file mode 100644 index 0000000..06ab211 --- /dev/null +++ b/src/Famix-Fortran77-Entities/FamixF77UnknownVariable.class.st @@ -0,0 +1,43 @@ +" +Variable used but not resolved + +## Relations +====================== + +### Incoming dependencies +| Relation | Origin | Opposite | Type | Comment | +|---| +| `incomingAccesses` | `FamixTAccessible` | `variable` | `FamixTAccess` | All Famix accesses pointing to this structural entity| + +### Other +| Relation | Origin | Opposite | Type | Comment | +|---| +| `declaredType` | `FamixTTypedEntity` | `typedEntities` | `FamixTType` | Type of the entity, if any| +| `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `isStub` | `Boolean` | false | Flag true if the entity attributes are incomplete, either because the entity is missing or not imported.| +| `name` | `String` | nil | Basic name of the entity, not full reference.| + +" +Class { + #name : #FamixF77UnknownVariable, + #superclass : #FamixF77Entity, + #traits : 'FamixTUnknownVariable', + #classTraits : 'FamixTUnknownVariable classTrait', + #category : #'Famix-Fortran77-Entities-Entities' +} + +{ #category : #meta } +FamixF77UnknownVariable class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Fortran77-Generator/FamixFortran77Generator.class.st b/src/Famix-Fortran77-Generator/FamixFortran77Generator.class.st index d529f38..2dbd6c2 100644 --- a/src/Famix-Fortran77-Generator/FamixFortran77Generator.class.st +++ b/src/Famix-Fortran77-Generator/FamixFortran77Generator.class.st @@ -56,7 +56,8 @@ Class { 'externalDeclaration', 'implicit', 'statementFunction', - 'tWithStatements' + 'tWithStatements', + 'unknownVariable' ], #category : #'Famix-Fortran77-Generator' } @@ -185,7 +186,12 @@ FamixFortran77Generator >> defineClasses [ variable := builder newClassNamed: #Variable - comment: self variableEntityComment + comment: self variableEntityComment. + + unknownVariable := builder + newClassNamed: #UnknownVariable + comment: 'Variable used but not resolved'. + ] { #category : #definition } @@ -277,7 +283,9 @@ FamixFortran77Generator >> defineHierarchy [ typeUnknown --|> type. - variable --|> #TLocalVariable + variable --|> #TLocalVariable. + + unknownVariable --|> #TUnknownVariable ] { #category : #definition }