Dependencies (DEPENDS_ON
)
→ dependencies between the various language concepts are realized by the DEPENDS_ON
relation
- direct dependencies are registered on a statement/expression level and propagated upwards to the next language construct that is represented as a concept in the graph
- import statements are ignored during this process which means declarations of unused imports will not be represented in the graph
- re-exports are resolved transitively as far as possible, that means dependencies are always targeting the original declaration, never some intermediary re-exporting module
- all registered direct dependencies of a concept are propagated/aggregated to all declaration levels above (see Propagation/Aggregation Strategy)
Properties:
Name | Description |
---|---|
cardinality | number of usages of the specific dependencies inside the language construct |
Origin Nodes
→ nodes from which DEPENDS_ON
relationships can originate
Core:
- :TS:Module
- :TS:Class
- :TS:Property
- :TS:Method
- :TS:AccessorProperty
- :TS:Interface
- :TS:TypeAlias
- :TS:Enum
- :TS:Variable
- :TS:Function
React Extension:
Target Nodes
→ nodes to which DEPENDS_ON
relationships can point to
- :TS:Module
- :TS:ExternalModule
- :TS:ExternalDeclaration
- :TS:Class
- :TS:Property
- :TS:Method
- :TS:AccessorProperty
- :TS:Interface
- :TS:TypeAlias
- :TS:Enum
- :TS:Variable
- :TS:Function
Propagation/Aggregation Strategy
→ dependencies that are registered at some level in the declaration hierarchy are registered on that level (e.g. at a property declaration) as well as on all the levels above (e.g. the containing class and module) where they are then aggregated with other existing dependencies
- this is done for both origin, and target of the dependency
Example: a.ts
export class A {
run(b: B): void {
b.prop = 5;
}
}
b.ts
export class B {
public prop: number = 0;
}
- There are two direct dependencies that are detected in a.ts:
- the class
B
is used once by the methodrun
as the type for the parameterb
- the property
prop
is used once by the methodrun
in its assignment statement
- the class
The following propagations/aggregations take place:
- Target propagation:
- the direct dependency to the method is propagated upwards to the class level where it is combined with the existing direct dependency to the class (leading to a combined cardinality of
2
) - the dependency to the class (with the aggregated cardinality of
2
) is propagated up once more to the module level
- the direct dependency to the method is propagated upwards to the class level where it is combined with the existing direct dependency to the class (leading to a combined cardinality of
- Source propagation:
- the previously calculated dependencies that originate from the method are now propagated up to its containing class and module respectively