Skip to content

Commit db83d4e

Browse files
committed
Make module not inherit from block
1 parent ae5dfc3 commit db83d4e

3 files changed

Lines changed: 26 additions & 24 deletions

File tree

src/FAST-Python-Model-Generator/FASTPythonMetamodelGenerator.class.st

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,9 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
471471
methodDefinition --|> statement.
472472
methodDefinition --|> tDefinition.
473473

474-
module --|> block. "A Module has statements."
474+
module --|> tStatementBlock.
475475
module --|> #THasImmediateSource.
476+
module withPrecedenceOf: #THasImmediateSource.
476477

477478
none --|> literal.
478479

src/FAST-Python-Model/FASTPyModule.class.st

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
## Relations
33
======================
44
5+
### Parents
6+
| Relation | Origin | Opposite | Type | Comment |
7+
|---|
8+
| `fastBehaviouralParent` | `FASTTStatementBlock` | `statementBlock` | `FASTTWithStatements` | Behavioural entity containing the statement block.|
9+
| `parentLoopStatement` | `FASTTStatement` | `body` | `FASTTLoopStatement` | Optional loop of which this statement is the body|
10+
| `statementContainer` | `FASTTStatement` | `statements` | `FASTTStatementBlock` | Block containing this statement.|
11+
12+
### Children
13+
| Relation | Origin | Opposite | Type | Comment |
14+
|---|
15+
| `statements` | `FASTTStatementBlock` | `statementContainer` | `FASTTStatement` | Statements enclosed in this block|
16+
517
### Other
618
| Relation | Origin | Opposite | Type | Comment |
719
|---|
@@ -13,14 +25,16 @@
1325
1426
| Name | Type | Default value | Comment |
1527
|---|
28+
| `endPos` | `Number` | nil | |
1629
| `source` | `String` | nil | Actual source code of the source entity|
30+
| `startPos` | `Number` | nil | |
1731
1832
"
1933
Class {
2034
#name : 'FASTPyModule',
21-
#superclass : 'FASTPyBlock',
22-
#traits : 'FamixTHasImmediateSource',
23-
#classTraits : 'FamixTHasImmediateSource classTrait',
35+
#superclass : 'FASTPyEntity',
36+
#traits : '(FASTTStatementBlock + FamixTHasImmediateSource withPrecedenceOf: FamixTHasImmediateSource)',
37+
#classTraits : '(FASTTStatementBlock classTrait + FamixTHasImmediateSource classTrait withPrecedenceOf: FamixTHasImmediateSource classTrait)',
2438
#category : 'FAST-Python-Model-Entities',
2539
#package : 'FAST-Python-Model',
2640
#tag : 'Entities'
@@ -29,7 +43,7 @@ Class {
2943
{ #category : 'meta' }
3044
FASTPyModule class >> annotation [
3145

32-
<FMClass: #Module super: #FASTPyBlock>
46+
<FMClass: #Module super: #FASTPyEntity>
3347
<package: #'FAST-Python-Model'>
3448
<generated>
3549
^ self

src/FAST-Python-Tools-Tests/FASTPythonImporterTest.class.st

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ FASTPythonImporterTest class >> traitsToIgnore [
7878
FASTPyTSplatParameter.
7979
FASTPyTSplatParameterTarget.
8080
FASTPyTPattern.
81-
FASTPyTClassPatternElement }
81+
FASTPyTClassPatternElement.
82+
FASTPyTDeletable }
8283
]
8384

8485
{ #category : 'running' }
@@ -3315,24 +3316,21 @@ FASTPythonImporterTest >> testDelStatementAttribute [
33153316
stack push: self topEntity expression.
33163317
self assert: self topEntity sourceCode equals: 'obj.attr'.
33173318
self assert: (self topEntity isOfType: FASTPyAttributeAccess).
3318-
self assert: (self topEntity isOfType: FASTPyTDeletable).
33193319

33203320
"Testing value of monovalue relation attribute"
33213321
self assert: self topEntity attribute isNotNil.
33223322

33233323
stack push: self topEntity attribute.
33243324
self assert: self topEntity sourceCode equals: 'attr'.
33253325
self assert: (self topEntity isOfType: FASTPyIdentifier).
3326-
self assert: (self topEntity isOfType: FASTPyTDeletable).
33273326
stack pop.
33283327

33293328
"Testing value of monovalue relation object"
33303329
self assert: self topEntity object isNotNil.
33313330

33323331
stack push: self topEntity object.
33333332
self assert: self topEntity sourceCode equals: 'obj'.
3334-
self assert: (self topEntity isOfType: FASTPyIdentifier).
3335-
self assert: (self topEntity isOfType: FASTPyTDeletable)
3333+
self assert: (self topEntity isOfType: FASTPyIdentifier)
33363334
]
33373335

33383336
{ #category : 'tests - statements' }
@@ -3359,44 +3357,38 @@ FASTPythonImporterTest >> testDelStatementMultiple [
33593357
stack push: self topEntity expression.
33603358
self assert: self topEntity sourceCode equals: 'obj1, obj2, obj.attr'.
33613359
self assert: (self topEntity isOfType: FASTPyTuple).
3362-
self assert: (self topEntity isOfType: FASTPyTDeletable).
33633360

33643361
"Testing value of multivalued relation initializers"
33653362
self assert: self topEntity initializers size equals: 3.
33663363

33673364
stack push: (stack top initializers at: 1).
33683365
self assert: self topEntity sourceCode equals: 'obj1'.
33693366
self assert: (self topEntity isOfType: FASTPyIdentifier).
3370-
self assert: (self topEntity isOfType: FASTPyTDeletable).
33713367
stack pop.
33723368

33733369
stack push: (stack top initializers at: 2).
33743370
self assert: self topEntity sourceCode equals: 'obj2'.
33753371
self assert: (self topEntity isOfType: FASTPyIdentifier).
3376-
self assert: (self topEntity isOfType: FASTPyTDeletable).
33773372
stack pop.
33783373

33793374
stack push: (stack top initializers at: 3).
33803375
self assert: self topEntity sourceCode equals: 'obj.attr'.
33813376
self assert: (self topEntity isOfType: FASTPyAttributeAccess).
3382-
self assert: (self topEntity isOfType: FASTPyTDeletable).
33833377

33843378
"Testing value of monovalue relation attribute"
33853379
self assert: self topEntity attribute isNotNil.
33863380

33873381
stack push: self topEntity attribute.
33883382
self assert: self topEntity sourceCode equals: 'attr'.
33893383
self assert: (self topEntity isOfType: FASTPyIdentifier).
3390-
self assert: (self topEntity isOfType: FASTPyTDeletable).
33913384
stack pop.
33923385

33933386
"Testing value of monovalue relation object"
33943387
self assert: self topEntity object isNotNil.
33953388

33963389
stack push: self topEntity object.
33973390
self assert: self topEntity sourceCode equals: 'obj'.
3398-
self assert: (self topEntity isOfType: FASTPyIdentifier).
3399-
self assert: (self topEntity isOfType: FASTPyTDeletable)
3391+
self assert: (self topEntity isOfType: FASTPyIdentifier)
34003392
]
34013393

34023394
{ #category : 'tests - statements' }
@@ -3424,7 +3416,6 @@ FASTPythonImporterTest >> testDelStatementSubscript [
34243416
stack push: self topEntity expression.
34253417
self assert: self topEntity sourceCode equals: 'obj.attrs[1]'.
34263418
self assert: (self topEntity isOfType: FASTPySubscript).
3427-
self assert: (self topEntity isOfType: FASTPyTDeletable).
34283419

34293420
"Testing value of multivalued relation indices"
34303421
self assert: self topEntity indices size equals: 1.
@@ -3442,24 +3433,21 @@ FASTPythonImporterTest >> testDelStatementSubscript [
34423433
stack push: self topEntity value.
34433434
self assert: self topEntity sourceCode equals: 'obj.attrs'.
34443435
self assert: (self topEntity isOfType: FASTPyAttributeAccess).
3445-
self assert: (self topEntity isOfType: FASTPyTDeletable).
34463436

34473437
"Testing value of monovalue relation attribute"
34483438
self assert: self topEntity attribute isNotNil.
34493439

34503440
stack push: self topEntity attribute.
34513441
self assert: self topEntity sourceCode equals: 'attrs'.
34523442
self assert: (self topEntity isOfType: FASTPyIdentifier).
3453-
self assert: (self topEntity isOfType: FASTPyTDeletable).
34543443
stack pop.
34553444

34563445
"Testing value of monovalue relation object"
34573446
self assert: self topEntity object isNotNil.
34583447

34593448
stack push: self topEntity object.
34603449
self assert: self topEntity sourceCode equals: 'obj'.
3461-
self assert: (self topEntity isOfType: FASTPyIdentifier).
3462-
self assert: (self topEntity isOfType: FASTPyTDeletable)
3450+
self assert: (self topEntity isOfType: FASTPyIdentifier)
34633451
]
34643452

34653453
{ #category : 'tests - statements' }
@@ -3483,8 +3471,7 @@ FASTPythonImporterTest >> testDelStatementTuple [
34833471

34843472
stack push: self topEntity expression.
34853473
self assert: self topEntity sourceCode equals: '()'.
3486-
self assert: (self topEntity isOfType: FASTPyTuple).
3487-
self assert: (self topEntity isOfType: FASTPyTDeletable)
3474+
self assert: (self topEntity isOfType: FASTPyTuple)
34883475
]
34893476

34903477
{ #category : 'tests - collections' }

0 commit comments

Comments
 (0)