This commit is contained in:
Jérôme Laban 2019-02-18 13:57:30 -05:00
Родитель 1e65cbc615
Коммит b243dbbe7a
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -38,11 +38,11 @@ namespace Uno.SampleGenerators
// This test ensures that dependent libraries are included in the compilation
// generated from the AdHoc workspace.
var dependentString = NewMethod(context, DependentTypeName, "_dependent");
var dependentString = BuildVariableFromType(context, DependentTypeName, "_dependent");
// This test ensures that linked files included in the project are included
// in the Compilation instance used by the generators.
var linkedString = NewMethod(context, LinkedTypeName, "_linked");
var linkedString = BuildVariableFromType(context, LinkedTypeName, "_linked");
context.AddCompilationUnit(
"Test",
@ -60,7 +60,7 @@ namespace Test {{
);
}
private static string NewMethod(SourceGeneratorContext context, string typeName, string variable)
private static string BuildVariableFromType(SourceGeneratorContext context, string typeName, string variable)
=> context.Compilation.GetTypeByMetadataName(typeName) is INamedTypeSymbol symbol
? $"static {symbol} {variable};"
: $"#error type {typeName} is not available";