Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
- run: smalltalkci -s ${{ matrix.smalltalk }}
shell: bash
timeout-minutes: 15
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: ${{matrix.smalltalk}}
parallel: true

finish-coveralls:
needs: build
Expand Down
2 changes: 1 addition & 1 deletion .smalltalk.ston
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SmalltalkCISpec {
#testing : {
#coverage : {
#packages : [ 'FAST-Core.*' ],
#packages : [ 'FAST-Core-Model', 'FAST-Core-Model-Extension', 'FAST-Core-Tools', 'FAST-Core-Visitor' ],
#format : #lcov
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/BaselineOfFAST/BaselineOfFAST.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ BaselineOfFAST >> definePackages: spec [
package: 'FAST-Core-Model-Extension' with: [ spec requires: #( 'FAST-Core-Model' ) ];
package: 'FAST-Core-Visitor' with: [ spec requires: #( 'FAST-Core-Model' ) ];
package: 'FAST-Model-Generator';
package: 'FAST-Core-Tests-Generator' with: [ spec requires: #( 'FAST-Core-Model' ) ];
package: 'FAST-Core-Tools' with: [ spec requires: #( 'FAST-Core-Visitor' ) ];
package: 'FAST-Core-Tools-Tests' with: [ spec requires: #( 'FAST-Core-Tools' ) ];
package: 'FAST-Core-Tools-Tests' with: [ spec requires: #( 'FAST-Core-Tools' 'FAST-Core-Tests-Generator' ) ];
package: 'FAST-Core-Deprecated'.

spec for: #NeedsMoose do: [
Expand Down
45 changes: 44 additions & 1 deletion src/FAST-Core-Model-Extension/FASTTEntity.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
Extension { #name : 'FASTTEntity' }

{ #category : '*FAST-Core-Model-Extension' }
FASTTEntity >> addNodesIncludedBetween: startLine and: endLine into: result [
"If an entity is in the lines, we add it to the result. If it is partialy in the lines, we check if they have a child inside."

self containedEntities do: [ :entity |
(entity isBetweenLine: startLine and: endLine) ifTrue: [ result add: entity ].
(entity isPartiallyBetweenLine: startLine and: endLine) ifTrue: [ entity addNodesIncludedBetween: startLine and: endLine into: result ] ]
]

{ #category : '*FAST-Core-Model-Extension' }
FASTTEntity >> asSourceCode [
"Export AST as code using an exporter if available."
Expand Down Expand Up @@ -92,10 +101,44 @@ FASTTEntity >> inspectionFASTSourceCode: aBuilder [
addTextSegmentDecoration: (SpTextPresenterDecorator forHighlight
interval: (self startPos to: self endPos);
yourself);
selectionInterval: (self startPos to: self endPos) ] ];
selectionInterval: (self startPos to: self endPos).
"I don't know why I need the double defer:... But it does not work without it. Also, this is bad because this is Morphic dependant. But I don't see how to do that with Spec for now."
this withAdapterPerformOrDefer: [ :anAdapter | this defer: [ this defer: [ anAdapter widget scrollPane scrollSelectionIntoView ] ] ] ] ];
yourself
]

{ #category : '*FAST-Core-Model-Extension' }
FASTTEntity >> isBetweenLine: startLine and: endLine [
"I return true if I am fully included in the lines as parameter."

^ self startLine >= startLine and: [ self endLine <= endLine ]
]

{ #category : '*FAST-Core-Model-Extension' }
FASTTEntity >> isPartiallyBetweenLine: startLine and: endLine [
"I return true if I am partially included in the lines as parameter. If I am fully inside the bound, I return false."

(self isBetweenLine: startLine and: endLine) ifTrue: [ ^ false ].

self endLine < startLine ifTrue: [ ^ false ].

self startLine > endLine ifTrue: [ ^ false ].

^ true
]

{ #category : '*FAST-Core-Model-Extension' }
FASTTEntity >> nodesIncludedBetween: startLine and: endLine [
"I return the nodes that are inside the given bounds, bounds included.
Nodes that are not entirely in the bounds are not considered.
We take the most high level node matching this. It means that if an assignment node for `x = 1` matches, we add only this one and not the identifier `x` and literal `1` since they are subnodes of the assignment."

| result |
result := OrderedCollection new.
self addNodesIncludedBetween: startLine and: endLine into: result.
^ result
]

{ #category : '*FAST-Core-Model-Extension' }
FASTTEntity >> orderedChildren [
^ self children asOrderedCollection sort: #startPos ascending
Expand Down
79 changes: 79 additions & 0 deletions src/FAST-Core-Tests-Generator/FASTTestMetamodelGenerator.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
Class {
#name : 'FASTTestMetamodelGenerator',
#superclass : 'FamixMetamodelGenerator',
#instVars : [
'entity',
'class',
'method',
'tEntity',
'tNamedBehaviouralEntity',
'tNamedEntity',
'tStatement',
'tStatementBlock'
],
#category : 'FAST-Core-Tests-Generator',
#package : 'FAST-Core-Tests-Generator'
}

{ #category : 'class initialization' }
FASTTestMetamodelGenerator class >> initialize [
"Generate the test MM when we load the generator to not save the generated code and ensure we start from a clean state."

self new generateWithCleaning
]

{ #category : 'accessing' }
FASTTestMetamodelGenerator class >> packageName [

^ #'FAST-Core-Test-Model'
]

{ #category : 'accessing' }
FASTTestMetamodelGenerator class >> prefix [

^ #FASTTest
]

{ #category : 'accessing' }
FASTTestMetamodelGenerator class >> submetamodels [

^ { FASTMetamodelGenerator }
]

{ #category : 'definition' }
FASTTestMetamodelGenerator >> defineClasses [

super defineClasses.

entity := builder newClassNamed: #Entity.
class := builder newClassNamed: #Class.
method := builder newClassNamed: #Method
]

{ #category : 'definition' }
FASTTestMetamodelGenerator >> defineHierarchy [

super defineHierarchy.
entity --|> tEntity.

class --|> entity.
class --|> tStatementBlock.
class --|> tNamedEntity.
class --|> #THasImmediateSource.
class withPrecedenceOf: #THasImmediateSource.

method --|> tStatement.
method --|> tNamedBehaviouralEntity
]

{ #category : 'definition' }
FASTTestMetamodelGenerator >> defineTraits [

super defineTraits.

tEntity := self remoteTrait: #TEntity withPrefix: #FAST.
tNamedBehaviouralEntity := self remoteTrait: #TNamedBehaviouralEntity withPrefix: #FAST.
tNamedEntity := self remoteTrait: #TNamedEntity withPrefix: #FAST.
tStatement := self remoteTrait: #TStatement withPrefix: #FAST.
tStatementBlock := self remoteTrait: #TStatementBlock withPrefix: #FAST
]
1 change: 1 addition & 0 deletions src/FAST-Core-Tests-Generator/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : 'FAST-Core-Tests-Generator' }
Loading
Loading