@@ -18,7 +18,7 @@ import {Point, Position} from "../model/position";
18
18
import { Issue , IssueSeverity , IssueType } from "../validation" ;
19
19
import { addLiteral , getEPackage } from "./ecore-basic" ;
20
20
import {
21
- STARLASU_URI_V2 ,
21
+ STARLASU_URI_V2 , THE_DESTINATION_INTERFACE ,
22
22
THE_ENTITY_DECLARATION_INTERFACE ,
23
23
THE_EXPRESSION_INTERFACE ,
24
24
THE_ISSUE_ECLASS ,
@@ -41,6 +41,7 @@ import {
41
41
import { KOLASU_URI_V1 , THE_NODE_ECLASS as THE_NODE_ECLASS_V1 } from "./kolasu-v1-metamodel" ;
42
42
import { EBigDecimal , EBigInteger } from "./ecore-patching" ;
43
43
import { NodeAdapter } from "../trace/trace-node" ;
44
+ import { EClassifier } from "ecore" ;
44
45
45
46
export * as starlasu_v2 from "./starlasu-v2-metamodel" ;
46
47
export * as kolasu_v1 from "./kolasu-v1-metamodel" ;
@@ -808,6 +809,11 @@ export function registerPackages(resource: ECore.Resource): ECore.EPackage[] {
808
809
} ) ;
809
810
}
810
811
812
+ export function isNodeType ( type : EClassifier ) {
813
+ return ( type . get ( "interface" ) && type != THE_DESTINATION_INTERFACE ) ||
814
+ type . get ( "eAllSuperTypes" ) ?. find ( t => t == THE_NODE_ECLASS_V2 || t == THE_NODE_ECLASS_V1 ) ;
815
+ }
816
+
811
817
export interface EcoreMetamodelSupport {
812
818
/**
813
819
* Generates the metamodel. The standard Kolasu metamodel [EPackage][org.eclipse.emf.ecore.EPackage] is included.
@@ -895,13 +901,13 @@ export class ECoreNode extends NodeAdapter {
895
901
for ( const ft of this . eo . eClass . get ( "eAllStructuralFeatures" ) ) {
896
902
const name = ft . get ( "name" ) ;
897
903
const isReference = ft . isTypeOf ( 'EReference' ) ;
898
- if ( isReference && ! ft . get ( "eType" ) ?. get ( "eAllSuperTypes" ) ?. find ( t => t == THE_NODE_ECLASS_V2 || t == THE_NODE_ECLASS_V1 ) ) {
904
+ if ( isReference && ! isNodeType ( ft . get ( "eType" ) ) ) {
899
905
// skip
900
906
} else {
901
907
result [ name ] = {
902
908
name,
903
909
child : isReference && ft . get ( 'containment' ) ,
904
- multiple : ( isReference && ft . get ( 'many' ) ) || undefined ,
910
+ multiple : isReference ? ft . get ( 'many' ) : undefined ,
905
911
} ;
906
912
}
907
913
}
0 commit comments