protected override IEnumerable <SyntaxNode> BuildNode(INodeModel statement, IPortModel portModel) { if (statement == null) { return(Enumerable.Empty <SyntaxNode>()); } Assert.IsTrue(portModel == null || portModel.NodeModel == statement, "If a Port is provided, it must be owned by the provided node"); // TODO : Find a better way to map [Node -> Current Archetype] if (!(context is RootContext) && statement.IsStacked) { var stencil = (EcsStencil)statement.GraphModel.Stencil; if (!stencil.ComponentDefinitions.ContainsKey(statement)) { stencil.ComponentDefinitions.Add(statement, context.GetComponentDefinitions()); } } Func <MethodInfo, bool> filterMethods = mi => mi.ReturnType == typeof(IEnumerable <SyntaxNode>) && mi.GetParameters().Length == 3 && mi.GetParameters()[2].ParameterType == typeof(IPortModel); Func <MethodInfo, Type> keySelector = mi => mi.GetParameters()[1].ParameterType; var ext = ModelUtility.ExtensionMethodCache <RoslynEcsTranslator> .GetExtensionMethod( statement.GetType(), filterMethods, keySelector) ?? ModelUtility.ExtensionMethodCache <RoslynTranslator> .GetExtensionMethod( statement.GetType(), filterMethods, keySelector); if (ext != null) { var syntaxNode = (IEnumerable <SyntaxNode>)ext.Invoke(null, new object[] { this, statement, portModel }) ?? Enumerable.Empty <SyntaxNode>(); var annotatedNodes = new List <SyntaxNode>(); foreach (var node in syntaxNode) { var annotatedNode = node?.WithAdditionalAnnotations(new SyntaxAnnotation(Annotations.AnnotationKind, statement.NodeAssetReference.GetInstanceID().ToString())); annotatedNodes.Add(annotatedNode); } return(annotatedNodes); } Debug.LogError("Roslyn ECS Translator doesn't know how to create a node of type: " + statement.GetType()); return(Enumerable.Empty <SyntaxNode>()); }