public static FinalAttributeSemantics[] FromSyntax(PassiveDeclarationSyntax syntax)
 {
     return(syntax.Parameters
            .Select(x => new FinalAttributeSemantics(x.TypeName,
                                                     FinalAttributeMemberSemantics.FromSyntax(x)))
            .ToArray());
 }
Ejemplo n.º 2
0
 public static PassiveDecoratorSemantics FromSyntax(PassiveDeclarationSyntax syntax)
 {
     return(new PassiveDecoratorSemantics(
                syntax.DecorationName,
                PassiveHookSemantics.FromDeclaration(syntax),
                PassiveModifierSemantics.FromDeclaration(syntax)));
 }
 public static PassiveModifierSemantics[] FromDeclaration(PassiveDeclarationSyntax syntax)
 {
     return(syntax.Parameters
            .SelectMany(x => x.Members)
            .Select(x => new PassiveModifierSemantics(x.TypeName, x.PropertyName))
            .ToArray());
 }
Ejemplo n.º 4
0
 public static SemanticsRoot FromSyntax(PassiveDeclarationSyntax syntax)
 {
     return(new SemanticsRoot(
                PassiveDecoratorSemantics.FromSyntax(syntax),
                FinalAttributeSemantics.FromSyntax(syntax),
                syntax.SourceType,
                syntax.DecorationName,
                syntax.DomainContextName));
 }
Ejemplo n.º 5
0
        public static async Task <Solution> ApplyCodeFix(Document document, TextSpan diagnosticSpan, CancellationToken ct)
        {
            var root = await document.GetSyntaxRootAsync(ct).ConfigureAwait(false);

            var declaration = root.FindToken(diagnosticSpan.Start)
                              .Parent
                              .AncestorsAndSelf()
                              .OfType <TypeDeclarationSyntax>()
                              .First();

            if (!(declaration is ClassDeclarationSyntax ids))
            {
                return(document.Project.Solution);
            }

            var syntax = await PassiveDeclarationSyntax.FromParseAsync(ids, document, ct);

            var semantics = SemanticsRoot.FromSyntax(syntax);
            var template  = new PassiveProcessTemplate(semantics);

            return(ApplyGeneratedCode(document, template));
        }
 public static PassiveHookSemantics[] FromDeclaration(PassiveDeclarationSyntax syntax)
 {
     return(syntax.BattleEvents
            .Select(x => new PassiveHookSemantics(x.TypeName))
            .ToArray());
 }
Ejemplo n.º 7
0
 public static PassiveHookHandlerSemantics FromSyntax(PassiveDeclarationSyntax syntax)
 {
     return(new PassiveHookHandlerSemantics("",
                                            BattleEventSemantics.FromSyntax(syntax)));
 }