protected override void VisitDfirRoot(DfirRoot dfirRoot) { base.VisitDfirRoot(dfirRoot); _typeVariableSet = dfirRoot.GetTypeVariableSet(); var variableSet = new VariableSet(_typeVariableSet); dfirRoot.SetVariableSet(variableSet); int rootDiagramLifetimeId = 0; foreach (DataItem dataItem in dfirRoot.DataItems) { // TODO: eventually we want to reuse each DataItem's variable for its DataAccessors' terminals. TypeVariableReference dataTypeVariable = _typeVariableSet.CreateTypeVariableReferenceFromNIType(dataItem.DataType); dataItem.SetVariable(variableSet.CreateNewVariable(rootDiagramLifetimeId, dataTypeVariable, true)); } }
protected override void VisitDfirRoot(DfirRoot dfirRoot) { base.VisitDfirRoot(dfirRoot); TypeVariableSet typeVariableSet = dfirRoot.GetTypeVariableSet(); dfirRoot.SetVariableSet(new VariableSet(typeVariableSet)); // Tech debt: none of this should be here. // When I first put in type inference for TypeDiagrams, I reused the VariableSet/TypeVariableSet stuff // for Function diagrams because it was convenient, even though TypeDiagrams don't need variables at all. // Later, to fix a bug, I required that creating a new VariableReference would require knowing the LifetimeGraphIdentifier // of the diagram that defines the VariableReference, which meant that a TypeDiagram's DfirRoot.BlockDiagram // would need a LifetimeGraphIdentifier. // // Removing this would require doing TypeDiagram type inference using just TypeVariableSet, and associating // TypeVariableReferences with Terminals without VariableReferences. dfirRoot.BlockDiagram.SetLifetimeGraphIdentifier(default(LifetimeGraphIdentifier)); }
protected override void VisitDfirRoot(DfirRoot dfirRoot) { base.VisitDfirRoot(dfirRoot); _typeVariableSet = dfirRoot.GetTypeVariableSet(); dfirRoot.SetVariableSet(new VariableSet(_typeVariableSet)); }