Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename importing context #759

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Famix-Deprecated/MooseImportingContext.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Class {
#name : #MooseImportingContext,
#superclass : #FamixStImporterContext,
#category : #'Famix-Deprecated'
}

{ #category : #testing }
MooseImportingContext class >> isDeprecated [

^ true
]
Original file line number Diff line number Diff line change
@@ -8,22 +8,22 @@ Class {
ImportingContextTest >> testAllDependentsOf [

| res1 res2 |
MooseImportingContext initialize.
res1 := MooseImportingContext new allDependentsOf: MooseImportingContext importingClass.
FamixStImporterContext initialize.
res1 := FamixStImporterContext new allDependentsOf: FamixStImporterContext importingClass.
self assert: res1 size equals: 2.
self assert: (res1 includes: MooseImportingContext importingClass).
res2 := MooseImportingContext new allDependentsOf: MooseImportingContext importingImplicitVariable.
self assert: (res1 includes: FamixStImporterContext importingClass).
res2 := FamixStImporterContext new allDependentsOf: FamixStImporterContext importingImplicitVariable.
self assert: res2 size equals: 4.
self assert: (res2 includes: MooseImportingContext importingClass).
self assert: (res2 includes: MooseImportingContext importingMethod).
self assert: (res2 includes: MooseImportingContext importingImplicitVariable)
self assert: (res2 includes: FamixStImporterContext importingClass).
self assert: (res2 includes: FamixStImporterContext importingMethod).
self assert: (res2 includes: FamixStImporterContext importingImplicitVariable)
]

{ #category : #tests }
ImportingContextTest >> testShouldComputeTypeOfAttributes [
| context |

context :=MooseImportingContext new.
context :=FamixStImporterContext new.
self deny: (context shouldComputeTypeOfAttributes).
context computeTypeOfAttributes.
self assert: (context shouldComputeTypeOfAttributes).
@@ -33,7 +33,7 @@ ImportingContextTest >> testShouldComputeTypeOfAttributes [
ImportingContextTest >> testShouldImportAllTheRest [

| context |
context := MooseImportingContext new.
context := FamixStImporterContext new.
context
importClass;
importMethod;
@@ -46,7 +46,7 @@ ImportingContextTest >> testShouldImportAllTheRest [
ImportingContextTest >> testShouldImportClasses [

| context |
context := MooseImportingContext new.
context := FamixStImporterContext new.
context importClass.
self assert: context shouldImportClass
]
@@ -58,7 +58,7 @@ ImportingContextTest >> testShouldImportClassesForInheritance [
entities without breaking it"

| context |
context :=MooseImportingContext new.
context :=FamixStImporterContext new.
context importInheritance.
(context class entityDependencies at: context class importingInheritance)
do: [:each | self assert: (context shouldImport: each)]
@@ -68,7 +68,7 @@ ImportingContextTest >> testShouldImportClassesForInheritance [
ImportingContextTest >> testShouldImportClassesForMethod [

| context |
context := MooseImportingContext new.
context := FamixStImporterContext new.
context importMethod.
self assert: context shouldImportClass
]
@@ -77,7 +77,7 @@ ImportingContextTest >> testShouldImportClassesForMethod [
ImportingContextTest >> testShouldImportMethodBody [

| context |
context :=MooseImportingContext new.
context :=FamixStImporterContext new.
context importArgument.
self assert: (context shouldImportMethodBody).
]
@@ -86,7 +86,7 @@ ImportingContextTest >> testShouldImportMethodBody [
ImportingContextTest >> testShouldImportMethodBody2 [

| context |
context :=MooseImportingContext new.
context :=FamixStImporterContext new.
context importImplicitVariable.

self assert: (context shouldImportMethodBody).
@@ -96,7 +96,7 @@ ImportingContextTest >> testShouldImportMethodBody2 [
ImportingContextTest >> testShouldImportMethodBodyBasedOnMaximum [

| context |
context :=MooseImportingContext new.
context :=FamixStImporterContext new.
context importMaximum.

self assert: (context shouldImportMethodBody).
10 changes: 5 additions & 5 deletions src/Moose-SmalltalkImporter-Core-Tests/MooseScripts.class.st
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ MooseScripts class >> createLightModelForLAN [
model := FamixStModel new.
model name: 'lightLAN'.
FamixStPharoImporterTask new
importingContext: (MooseImportingContext new
importingContext: (FamixStImporterContext new
importClass;
importMethod;
importInheritance;
@@ -44,7 +44,7 @@ MooseScripts class >> createLightModelForMorphic [
model := FamixStModel new.
model name: 'lightMorphic'.
FamixStPharoImporterTask new
importingContext: (MooseImportingContext new
importingContext: (FamixStImporterContext new
importClass;
importMethod;
importInheritance;
@@ -74,7 +74,7 @@ MooseScripts class >> createLightModelForNetwork [
model := FamixStModel new.
model name: 'lightNetwork'.
FamixStPharoImporterTask new
importingContext: (MooseImportingContext new
importingContext: (FamixStImporterContext new
importClass;
importMethod;
importInheritance;
@@ -103,7 +103,7 @@ MooseScripts class >> createLightModelForPharo [
model := FamixStModel new.
model name: 'lightPharo'.
FamixStPharoImporterTask new
importingContext: (MooseImportingContext new
importingContext: (FamixStImporterContext new
importClass;
importMethod;
importInheritance;
@@ -213,7 +213,7 @@ MooseScripts class >> createModelNamed: modelName withPackages: packages importe
mooseModel := FamixStModel new.
mooseModel name: modelName.

importingContext := MooseImportingContext new.
importingContext := FamixStImporterContext new.
(context select: [:anAssoc | anAssoc value = true] thenCollect: [:each | each key]) do: [ :each | importingContext perform: (#import , each) asSymbol ].
merge ifTrue: [ importingContext mergeClassAndMetaclass ].

Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ MooseSmalltalkImporterSubclassesTest >> setUp [
model name: 'Test'.
pharoImporterTask := FamixStPharoImporterTask new
doNotRunCandidateOperator;
importingContext: (MooseImportingContext new
importingContext: (FamixStImporterContext new
importPackage;
importInheritance;
importAccess;
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ FamixStepwiseImporterTest >> testCheckFormalParameterIsCreated [
| mseFormalParameter model |
model := FamixStModel new.
FamixStPharoImporterTask new
importingContext: (MooseImportingContext new
importingContext: (FamixStImporterContext new
importImplicitVariable;
importAccess;
mergeClassAndMetaclass;
@@ -44,7 +44,7 @@ FamixStepwiseImporterTest >> testCheckSelfIsCreated [
| model mseSelf |
model := FamixStModel new.
FamixStPharoImporterTask new
importingContext: (MooseImportingContext new
importingContext: (FamixStImporterContext new
importImplicitVariable;
importAccess;
mergeClassAndMetaclass;
@@ -62,7 +62,7 @@ FamixStepwiseImporterTest >> testImportAttribute [

| importTask importer nodeClass |
importTask := self newImportClassesTask.
importTask importingContext: (MooseImportingContext new
importTask importingContext: (FamixStImporterContext new
importClass;
importAttribute;
importMethod;
@@ -80,7 +80,7 @@ FamixStepwiseImporterTest >> testImportAttributeAccesses [

| importTask importer nodeClass attr |
importTask := self newImportClassesTask.
importTask importingContext: (MooseImportingContext new
importTask importingContext: (FamixStImporterContext new
importClass;
importAttribute;
importMethod;
@@ -100,7 +100,7 @@ FamixStepwiseImporterTest >> testImportClassAndAttributeAndMergeItsMetaclass [

| importTask importer nodeClass |
importTask := self newImportClassesTask.
importTask importingContext: (MooseImportingContext new
importTask importingContext: (FamixStImporterContext new
importClass;
importAttribute;
mergeClassAndMetaclass;
@@ -116,7 +116,7 @@ FamixStepwiseImporterTest >> testImportClassAndInheritance [

| importTask importer importedClasses |
importTask := self newImportClassesTask.
importTask importingContext: (MooseImportingContext new
importTask importingContext: (FamixStImporterContext new
importClass;
importInheritance;
mergeClassAndMetaclass;
@@ -134,7 +134,7 @@ FamixStepwiseImporterTest >> testImportClassAndMethodAndMergeItsMetaclass [

| importTask importer importedMethods |
importTask := self newImportClassesTask.
importTask importingContext: (MooseImportingContext new
importTask importingContext: (FamixStImporterContext new
importClass;
importMethod;
mergeClassAndMetaclass;
@@ -153,7 +153,7 @@ FamixStepwiseImporterTest >> testImportLANPackage [
model := FamixStModel new.
FamixStPharoImporterTask new
doNotRunCandidateOperator;
importingContext: (MooseImportingContext new
importingContext: (FamixStImporterContext new
importClass;
importPackage;
yourself);
@@ -172,7 +172,7 @@ FamixStepwiseImporterTest >> testImportMergingMetaclassDoesNotDuplicateComment [

| importTask importer comments |
importTask := self newImportClassesTask.
importTask importingContext: (MooseImportingContext new
importTask importingContext: (FamixStImporterContext new
importClass;
importComment;
mergeClassAndMetaclass;
@@ -194,7 +194,7 @@ FamixStepwiseImporterTest >> testImportMethodBody [

| importTask importer context importedClasses famixClassNode nextNodeMethod nameMethod xFormalParameter |
importTask := self newImportClassesTask.
context := MooseImportingContext new
context := FamixStImporterContext new
importArgument;
mergeClassAndMetaclass;
yourself.
@@ -226,7 +226,7 @@ FamixStepwiseImporterTest >> testImportNamespace [
model := FamixStModel new.
FamixStPharoImporterTask new
doNotRunCandidateOperator;
importingContext: (MooseImportingContext new
importingContext: (FamixStImporterContext new
importNamespace;
importClass;
importPackage;
@@ -244,7 +244,7 @@ FamixStepwiseImporterTest >> testImportOneClassAndItsMetaclass [

| importTask importer importedClasses |
importTask := self newImportClassesTask.
importTask importingContext: MooseImportingContext new importClass.
importTask importingContext: FamixStImporterContext new importClass.
importTask addClass: LANNode.
self assert: importTask classes size equals: 1.
importer := importTask run.
@@ -258,7 +258,7 @@ FamixStepwiseImporterTest >> testImportOneClassAndMergeItsMetaclass [

| importTask importer importedClasses |
importTask := self newImportClassesTask.
importTask importingContext: (MooseImportingContext new
importTask importingContext: (FamixStImporterContext new
importClass;
mergeClassAndMetaclass;
yourself).
@@ -275,7 +275,7 @@ FamixStepwiseImporterTest >> testImportOneClassAndMethodAndMergeItsMetaclass [

| importTask importer importedMethods |
importTask := self newImportClassesTask.
importTask importingContext: (MooseImportingContext new
importTask importingContext: (FamixStImporterContext new
importClass;
importMethod;
mergeClassAndMetaclass;
@@ -292,7 +292,7 @@ FamixStepwiseImporterTest >> testImportOneClassAndOneAttributeAndMergeItsMetacla

| importTask importer nodeClass |
importTask := self newImportClassesTask.
importTask importingContext: (MooseImportingContext new
importTask importingContext: (FamixStImporterContext new
importClass;
importAttribute;
mergeClassAndMetaclass;
@@ -308,7 +308,7 @@ FamixStepwiseImporterTest >> testImportWithoutMergingMetaclassDoesDuplicateComme

| importTask importer comments |
importTask := self newImportClassesTask.
importTask importingContext: (MooseImportingContext new
importTask importingContext: (FamixStImporterContext new
importClass;
importComment;
distinguishClassAndMetaclass;
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ MoosePharoImporterTaskOnLANTest >> testImportClassUsingAddCategory [
| model |
FamixStPharoImporterTask new
model: (model := FamixStModel new);
importingContext: MooseImportingContext new importClass;
importingContext: FamixStImporterContext new importClass;
addFromPackage: (self packageOrganizer packageNamed: #'Moose-TestResources-LAN');
run.
self assert: model allClasses size equals: (self numberOfClassesIn: #( 'Moose-TestResources-LAN' )) * 2
@@ -49,7 +49,7 @@ MoosePharoImporterTaskOnLANTest >> testImportClassUsingAddClass [
| model |
FamixStPharoImporterTask new
model: (model := FamixStModel new);
importingContext: MooseImportingContext new importClass;
importingContext: FamixStImporterContext new importClass;
addClass: LANNode;
run.
self assert: model allClasses size equals: LANNode subclasses size + 1 * 2
@@ -61,7 +61,7 @@ MoosePharoImporterTaskOnLANTest >> testImportClassUsingAddPackage [
| model |
FamixStPharoImporterTask new
model: (model := FamixStModel new);
importingContext: MooseImportingContext new importClass;
importingContext: FamixStImporterContext new importClass;
addFromPackage: (self packageOrganizer packageNamed: #'Moose-TestResources-LAN');
run.
self assert: model allClasses size equals: 2 * (self packageOrganizer packageNamed: #'Moose-TestResources-LAN') definedClasses size
@@ -73,7 +73,7 @@ MoosePharoImporterTaskOnLANTest >> testImportClassUsingAddPackageNamed [
| model |
FamixStPharoImporterTask new
model: (model := FamixStModel new);
importingContext: MooseImportingContext new importClass;
importingContext: FamixStImporterContext new importClass;
addFromPackageNamed: 'Moose-TestResources-LAN';
run.
self assert: model allClasses size equals: 2 * (self packageOrganizer packageNamed: #'Moose-TestResources-LAN') definedClasses size

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ FamixStPharoImporterTask >> defaultImportingContext [
"does not import stub methods by default because it can create a lot of methods"

| context |
context := MooseImportingContext new importMaximum.
context := FamixStImporterContext new importMaximum.
context entityKindsToBeExtracted remove: context class importingSmalltalkStubMethod.
^ context
]
2 changes: 1 addition & 1 deletion src/Moose-SmalltalkImporter/FamixStTImportUtils.trait.st
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ FamixStTImportUtils >> classes [

{ #category : #accessing }
FamixStTImportUtils >> defaultImportingContext [
^ MooseImportingContext new importMaximum
^ FamixStImporterContext new importMaximum
]

{ #category : #accessing }