11Class {
2- #name : # FamixTypeScriptGenerator ,
3- #superclass : # FamixBasicInfrastructureGenerator ,
2+ #name : ' FamixTypeScriptGenerator' ,
3+ #superclass : ' FamixBasicInfrastructureGenerator' ,
44 #instVars : [
55 ' access' ,
66 ' class' ,
@@ -44,30 +44,32 @@ Class {
4444 ' parametricClass' ,
4545 ' parametricInterface' ,
4646 ' concretization' ,
47- ' parameterConcretization'
47+ ' parameterConcretization' ,
48+ ' tTypeScriptFunctionMetrics'
4849 ],
49- #category : #' Famix-TypeScript-Generator'
50+ #category : ' Famix-TypeScript-Generator' ,
51+ #package : ' Famix-TypeScript-Generator'
5052}
5153
52- { #category : # accessing }
54+ { #category : ' accessing' }
5355FamixTypeScriptGenerator class >> packageName [
5456
5557 ^ #' Famix-TypeScript-Entities'
5658]
5759
58- { #category : # accessing }
60+ { #category : ' accessing' }
5961FamixTypeScriptGenerator class >> packageNameForAnnotations [
6062
6163 ^ #' FamixTypeScript'
6264]
6365
64- { #category : # accessing }
66+ { #category : ' accessing' }
6567FamixTypeScriptGenerator class >> prefix [
6668
6769 ^ #' FamixTypeScript'
6870]
6971
70- { #category : # accessing }
72+ { #category : ' accessing' }
7173FamixTypeScriptGenerator class >> translationDictionary [
7274
7375 | classNames associations |
@@ -79,7 +81,7 @@ FamixTypeScriptGenerator class >> translationDictionary [
7981 ^ Dictionary newFrom: associations.
8082]
8183
82- { #category : # comments }
84+ { #category : ' comments' }
8385FamixTypeScriptGenerator >> commentForConcretization [
8486 " To verify"
8587 ^ ' ## Relations
@@ -113,7 +115,7 @@ FamixTypeScriptGenerator >> commentForConcretization [
113115'
114116]
115117
116- { #category : # ' as yet unclassified' }
118+ { #category : ' as yet unclassified' }
117119FamixTypeScriptGenerator >> commentForParameterConcretization [
118120 ^ ' ## Relations
119121======================
@@ -146,7 +148,7 @@ FamixTypeScriptGenerator >> commentForParameterConcretization [
146148'
147149]
148150
149- { #category : # comments }
151+ { #category : ' comments' }
150152FamixTypeScriptGenerator >> commentForTCanBeInterface [
151153 ^ ' I allow an entity to be an interface abstraction
152154ex:
@@ -158,13 +160,13 @@ public interface Flyable {
158160```'
159161]
160162
161- { #category : # definition }
163+ { #category : ' definition' }
162164FamixTypeScriptGenerator >> commentForTWithInterfaces [
163165
164166^ ' I can contain interfaces (Packages, Methods, Classes...)'
165167]
166168
167- { #category : # definition }
169+ { #category : ' definition' }
168170FamixTypeScriptGenerator >> defineClasses [
169171
170172 super defineClasses.
@@ -221,7 +223,7 @@ FamixTypeScriptGenerator >> defineClasses [
221223 " self defineComments."
222224]
223225
224- { #category : # definition }
226+ { #category : ' definition' }
225227FamixTypeScriptGenerator >> defineHierarchy [
226228
227229 super defineHierarchy.
@@ -283,6 +285,7 @@ FamixTypeScriptGenerator >> defineHierarchy [
283285 function -- | > #TDefinedInModule .
284286 function -- | > #TInvocable .
285287 function -- | > #TImportable .
288+ function -- | > #TFunctionMetrics .
286289
287290 parametricFunction -- | > function.
288291 parametricFunction -- | > #TParametricEntity .
@@ -292,6 +295,7 @@ FamixTypeScriptGenerator >> defineHierarchy [
292295 arrowFunction -- | > #TDefinedInModule .
293296 arrowFunction -- | > #TInvocable .
294297 arrowFunction -- | > #TImportable .
298+ arrowFunction -- | > #TFunctionMetrics . " Dublicate code for adding cyclomatic complexity"
295299
296300 parametricArrowFunction -- | > arrowFunction.
297301 parametricArrowFunction -- | > #TParametricEntity .
@@ -416,7 +420,7 @@ FamixTypeScriptGenerator >> defineHierarchy [
416420 parameterType -- | > #TWithInheritances .
417421]
418422
419- { #category : # definition }
423+ { #category : ' definition' }
420424FamixTypeScriptGenerator >> defineProperties [
421425
422426 super defineProperties.
@@ -433,7 +437,16 @@ FamixTypeScriptGenerator >> defineProperties [
433437 comment: ' Properties may be postfixed with a private modifier that makes the property private even in JavaScript.' .
434438 (comment property: #isJSDoc type: #Boolean defaultValue: false )
435439 comment: ' Comments can have the form of JSDoc.' .
440+
441+ " Trait Properties can be exported into another function"
442+ " Adding the following for cyclomatic complexity property for TFunctionMetrics"
443+ (tTypeScriptFunctionMetrics property: #cyclomaticComplexity type: #Number defaultValue: 0 )
444+ comment: ' Cyclomatic Complexity Property for Functions.' .
436445
446+ (module property: #isAmbient type: #Boolean defaultValue: false ).
447+ (module property: #isModule type: #Boolean defaultValue: false ).
448+ (module property: #isNamespace type: #Boolean defaultValue: false ).
449+
437450 " The following are not need because of THasKind (?)"
438451
439452 " (method property: #isConstructor type: #Boolean defaultValue: false)
@@ -442,25 +455,28 @@ FamixTypeScriptGenerator >> defineProperties [
442455 comment: 'Method is a getter'.
443456 (method property: #isSetter type: #Boolean defaultValue: false)
444457 comment: 'Method is a setter'"
458+
459+
445460]
446461
447- { #category : # definition }
462+ { #category : ' definition' }
448463FamixTypeScriptGenerator >> defineRelations [
449464 super defineRelations.
450465 (decorator property: #decoratedEntity ) *- (namedEntity property: #decorators ).
451466]
452467
453- { #category : # definition }
468+ { #category : ' definition' }
454469FamixTypeScriptGenerator >> defineTraits [
455470
456471 super defineTraits.
457472 tWithInterfaces := builder newTraitNamed: #TWithInterfaces .
458473 tWithInterfaces comment: self commentForTWithInterfaces.
459474
460475 tTypeScriptClassMetrics := builder newTraitNamed: #TClassMetrics .
476+ tTypeScriptFunctionMetrics := builder newTraitNamed: #TFunctionMetrics .
461477]
462478
463- { #category : # definition }
479+ { #category : ' definition' }
464480FamixTypeScriptGenerator >> newBuilder [
465481
466482 ^ super newBuilder
0 commit comments