protected override void AppendFeature(IT4Code code, IT4AppendableElementDescription description)
        {
            if (code.IsVisibleInDocumentUnsafe())
            {
                Result.AppendFeature(description);
                return;
            }

            // We are generating partial class for preprocessed template.
            // It would be very convenient to generate partial classes for every T4 file
            // with every class containing all and only features defined in that file.
            // However, that's not always possible because includes can be included into several files.
            // Therefore we have to take into account whether the current root file
            // is selected as the root for that include file.
            var containingFile = (IT4File)code.GetContainingFile().NotNull();

            if (Graph.FindBestRoot(containingFile.LogicalPsiSourceFile) == Root)
            {
                // If they share the same root, the include will generate
                // a partial class with all the features in it,
                // so we should not generate anything here to avoid resolution errors.
                return;
            }

            // Otherwise it will generate a part for some other class,
            // which means that the only way we will get class features
            // is if we generate them in the root file of this preprocessed template tree
            if (!IsRootFile)
            {
                return;
            }
            Result.AppendFeature(description);
        }
 public override void AppendMappedIfNeeded(T4CSharpCodeGenerationResult destination, IT4Code code) =>
 destination.Append(code.GetText().Trim());
 protected override void AppendFeature(IT4Code code, IT4AppendableElementDescription description) =>
 Result.AppendFeature(description);
		protected abstract void AppendFeature(
			[NotNull] IT4Code code,
			[NotNull] IT4AppendableElementDescription description
		);
Exemplo n.º 5
0
 public T4ExpressionDescription([NotNull] IT4Code source) => Source = source;
Exemplo n.º 6
0
 protected override void AppendFeature(IT4Code code, IT4AppendableElementDescription description)
 {
     // The simple case: all executable files reside in separate PSI modules,
     // so we generate complete code for them no matter what
     Result.AppendFeature(description);
 }
Exemplo n.º 7
0
 public T4FeatureExpressionDescription([NotNull] IT4Code source) : base(source)
 {
 }
Exemplo n.º 8
0
 public T4CodeDescription([NotNull] IT4Code source) => Source = source;
 public abstract void AppendMappedIfNeeded(T4CSharpCodeGenerationResult destination, IT4Code code);