예제 #1
0
        public static ISourceGeneratorLogger GetLogger(this SourceGeneratorContext context)
        {
            if (_logger.TryGetValue(context, out var logger))
            {
                return(logger);
            }

            throw new InvalidOperationException("The SourceGeneratorContext has not been initialized from a SourceGeneratorHost.");
        }
예제 #2
0
        public static ProjectInstance GetProjectInstance(this SourceGeneratorContext context)
        {
            if (_project.TryGetValue(context, out var instance))
            {
                return(instance);
            }

            throw new InvalidOperationException("The SourceGeneratorContext has not been initialized from a SourceGeneratorHost.");
        }
		public static void SetProjectInstance(this SourceGeneratorContext context, ProjectInstance projectInstance)
		{
			_project.Add(context, projectInstance);
		}
 public abstract void Execute(SourceGeneratorContext context);
예제 #5
0
 public static void SetLogger(this SourceGeneratorContext context, ISourceGeneratorLogger logger)
 {
     _logger.Add(context, logger);
 }