private void ValidateBinding( TagHelperBinding bindingResult, string tagName, MarkupStartTagSyntax tagBlock) { // Ensure that all descriptors associated with this tag have appropriate TagStructures. Cannot have // multiple descriptors that expect different TagStructures (other than TagStructure.Unspecified). TagHelperDescriptor baseDescriptor = null; TagStructure? baseStructure = null; foreach (var descriptor in bindingResult.Descriptors) { var boundRules = bindingResult.Mappings[descriptor]; foreach (var rule in boundRules) { if (rule.TagStructure != TagStructure.Unspecified) { // Can't have a set of TagHelpers that expect different structures. if (baseStructure.HasValue && baseStructure != rule.TagStructure) { _errorSink.OnError( RazorDiagnosticFactory.CreateTagHelper_InconsistentTagStructure( new SourceSpan(tagBlock.GetSourceLocation(_source), tagBlock.FullWidth), baseDescriptor.DisplayName, descriptor.DisplayName, tagName)); } baseDescriptor = descriptor; baseStructure = rule.TagStructure; } } } }
private static SourceLocation GetStartTagDeclarationErrorStart(MarkupStartTagSyntax tagBlock, RazorSourceDocument source) { return(SourceLocationTracker.Advance(tagBlock.GetSourceLocation(source), "<")); }