public void Validate(DecoratorSyntax decoratorSyntax, TypeSymbol targetType, ITypeManager typeManager, IDiagnosticWriter diagnosticWriter) { if (targetType is ErrorType) { return; } this.validator?.Invoke(this.Overload.Name, decoratorSyntax, targetType, typeManager, diagnosticWriter); }
public ObjectSyntax?Evaluate(DecoratorSyntax decoratorSyntax, TypeSymbol targetType, ObjectSyntax?targetObject) { if (this.evaluator is null) { return(targetObject); } return(this.evaluator(decoratorSyntax, targetType, targetObject)); }
public void Validate(DecoratorSyntax decoratorSyntax, TypeSymbol targetType, ITypeManager typeManager, IBinder binder, IDiagnosticWriter diagnosticWriter) { if (targetType is ErrorType) { return; } if (!this.CanAttachTo(targetType)) { diagnosticWriter.Write(DiagnosticBuilder.ForPosition(decoratorSyntax).CannotAttachDecoratorToTarget(this.Overload.Name, attachableType, targetType)); } // Invoke custom validator if provided. this.validator?.Invoke(this.Overload.Name, decoratorSyntax, targetType, typeManager, binder, diagnosticWriter); }
public void Validate(DecoratorSyntax decoratorSyntax, TypeSymbol targetType, ITypeManager typeManager, IDiagnosticWriter diagnosticWriter) { if (targetType is ErrorType) { return; } if (this.validator != null) { this.validator.Invoke(this.Overload.Name, decoratorSyntax, targetType, typeManager, diagnosticWriter); return; } // No custom validator provided. Just validate the target type. if (!this.CanAttachTo(targetType)) { diagnosticWriter.Write(DiagnosticBuilder.ForPosition(decoratorSyntax).CannotAttacheDecoratorToTarget(this.Overload.Name, attachableType, targetType)); } }
public override void VisitDecoratorSyntax(DecoratorSyntax syntax) => this.BuildWithConcat(() => base.VisitDecoratorSyntax(syntax));
static SyntaxBase SingleArgumentSelector(DecoratorSyntax decoratorSyntax) => decoratorSyntax.Arguments.Single().Expression;
public override void VisitDecoratorSyntax(DecoratorSyntax syntax) { this.currentDecorator = syntax; base.VisitDecoratorSyntax(syntax); this.currentDecorator = null; }