コード例 #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.");
        }
コード例 #3
0
		public static void SetProjectInstance(this SourceGeneratorContext context, ProjectInstance projectInstance)
		{
			_project.Add(context, projectInstance);
		}
コード例 #4
0
 public abstract void Execute(SourceGeneratorContext context);
コード例 #5
0
 public static void SetLogger(this SourceGeneratorContext context, ISourceGeneratorLogger logger)
 {
     _logger.Add(context, logger);
 }