@@ -29,8 +29,8 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte
29
29
}
30
30
31
31
// For each @bind *usage* we need to rewrite the tag helper node to map to basic constructs.
32
- var references = documentNode . FindDescendantReferences < TagHelperPropertyIntermediateNode > ( ) ;
33
- var parameterReferences = documentNode . FindDescendantReferences < TagHelperAttributeParameterIntermediateNode > ( ) ;
32
+ var references = documentNode . FindDescendantReferences < TagHelperDirectiveAttributeIntermediateNode > ( ) ;
33
+ var parameterReferences = documentNode . FindDescendantReferences < TagHelperDirectiveAttributeParameterIntermediateNode > ( ) ;
34
34
35
35
var parents = new HashSet < IntermediateNode > ( ) ;
36
36
for ( var i = 0 ; i < references . Count ; i ++ )
@@ -56,15 +56,15 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte
56
56
{
57
57
var reference = references [ i ] ;
58
58
var parent = reference . Parent ;
59
- var node = ( TagHelperPropertyIntermediateNode ) reference . Node ;
59
+ var node = ( TagHelperDirectiveAttributeIntermediateNode ) reference . Node ;
60
60
61
61
if ( ! parent . Children . Contains ( node ) )
62
62
{
63
63
// This node was removed as a duplicate, skip it.
64
64
continue ;
65
65
}
66
66
67
- if ( node . TagHelper . IsBindTagHelper ( ) && node . IsDirectiveAttribute )
67
+ if ( node . TagHelper . IsBindTagHelper ( ) )
68
68
{
69
69
bindEntries [ ( parent , node . AttributeName ) ] = new BindEntry ( reference ) ;
70
70
}
@@ -75,15 +75,15 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte
75
75
{
76
76
var parameterReference = parameterReferences [ i ] ;
77
77
var parent = parameterReference . Parent ;
78
- var node = ( TagHelperAttributeParameterIntermediateNode ) parameterReference . Node ;
78
+ var node = ( TagHelperDirectiveAttributeParameterIntermediateNode ) parameterReference . Node ;
79
79
80
80
if ( ! parent . Children . Contains ( node ) )
81
81
{
82
82
// This node was removed as a duplicate, skip it.
83
83
continue ;
84
84
}
85
85
86
- if ( node . TagHelper . IsBindTagHelper ( ) && node . IsDirectiveAttribute )
86
+ if ( node . TagHelper . IsBindTagHelper ( ) )
87
87
{
88
88
// Check if this tag contains a corresponding non-parameterized bind node.
89
89
if ( ! bindEntries . TryGetValue ( ( parent , node . AttributeNameWithoutParameter ) , out var entry ) )
@@ -140,12 +140,12 @@ private void ProcessDuplicates(IntermediateNode node)
140
140
TagHelperDescriptor tagHelper = null ;
141
141
string attributeName = null ;
142
142
var attribute = node . Children [ i ] ;
143
- if ( attribute is TagHelperPropertyIntermediateNode propertyAttribute )
143
+ if ( attribute is TagHelperDirectiveAttributeIntermediateNode directiveAttribute )
144
144
{
145
- attributeName = propertyAttribute . AttributeName ;
146
- tagHelper = propertyAttribute . TagHelper ;
145
+ attributeName = directiveAttribute . AttributeName ;
146
+ tagHelper = directiveAttribute . TagHelper ;
147
147
}
148
- else if ( attribute is TagHelperAttributeParameterIntermediateNode parameterAttribute )
148
+ else if ( attribute is TagHelperDirectiveAttributeParameterIntermediateNode parameterAttribute )
149
149
{
150
150
attributeName = parameterAttribute . AttributeName ;
151
151
tagHelper = parameterAttribute . TagHelper ;
@@ -159,12 +159,12 @@ private void ProcessDuplicates(IntermediateNode node)
159
159
TagHelperDescriptor duplicateTagHelper = null ;
160
160
string duplicateAttributeName = null ;
161
161
var duplicate = node . Children [ j ] ;
162
- if ( duplicate is TagHelperPropertyIntermediateNode duplicatePropertyAttribute )
162
+ if ( duplicate is TagHelperDirectiveAttributeIntermediateNode duplicateDirectiveAttribute )
163
163
{
164
- duplicateAttributeName = duplicatePropertyAttribute . AttributeName ;
165
- duplicateTagHelper = duplicatePropertyAttribute . TagHelper ;
164
+ duplicateAttributeName = duplicateDirectiveAttribute . AttributeName ;
165
+ duplicateTagHelper = duplicateDirectiveAttribute . TagHelper ;
166
166
}
167
- else if ( duplicate is TagHelperAttributeParameterIntermediateNode duplicateParameterAttribute )
167
+ else if ( duplicate is TagHelperDirectiveAttributeParameterIntermediateNode duplicateParameterAttribute )
168
168
{
169
169
duplicateAttributeName = duplicateParameterAttribute . AttributeName ;
170
170
duplicateTagHelper = duplicateParameterAttribute . TagHelper ;
@@ -195,12 +195,12 @@ private void ProcessDuplicates(IntermediateNode node)
195
195
TagHelperDescriptor duplicateTagHelper = null ;
196
196
string duplicateAttributeName = null ;
197
197
var duplicate = node . Children [ j ] ;
198
- if ( duplicate is TagHelperPropertyIntermediateNode duplicatePropertyAttribute )
198
+ if ( duplicate is TagHelperDirectiveAttributeIntermediateNode duplicateDirectiveAttribute )
199
199
{
200
- duplicateAttributeName = duplicatePropertyAttribute . AttributeName ;
201
- duplicateTagHelper = duplicatePropertyAttribute . TagHelper ;
200
+ duplicateAttributeName = duplicateDirectiveAttribute . AttributeName ;
201
+ duplicateTagHelper = duplicateDirectiveAttribute . TagHelper ;
202
202
}
203
- else if ( duplicate is TagHelperAttributeParameterIntermediateNode duplicateParameterAttribute )
203
+ else if ( duplicate is TagHelperDirectiveAttributeParameterIntermediateNode duplicateParameterAttribute )
204
204
{
205
205
duplicateAttributeName = duplicateParameterAttribute . AttributeName ;
206
206
duplicateTagHelper = duplicateParameterAttribute . TagHelper ;
@@ -222,15 +222,15 @@ private void ProcessDuplicates(IntermediateNode node)
222
222
223
223
// If we still have duplicates at this point then they are genuine conflicts.
224
224
var duplicates = node . Children
225
- . OfType < TagHelperPropertyIntermediateNode > ( )
225
+ . OfType < TagHelperDirectiveAttributeIntermediateNode > ( )
226
226
. GroupBy ( p => p . AttributeName )
227
227
. Where ( g => g . Count ( ) > 1 ) ;
228
228
229
229
foreach ( var duplicate in duplicates )
230
230
{
231
231
node . Diagnostics . Add ( ComponentDiagnosticFactory . CreateBindAttribute_Duplicates (
232
232
node . Source ,
233
- duplicate . Key ,
233
+ duplicate . First ( ) . OriginalAttributeName ,
234
234
duplicate . ToArray ( ) ) ) ;
235
235
foreach ( var property in duplicate )
236
236
{
@@ -338,7 +338,7 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE
338
338
{
339
339
Annotations =
340
340
{
341
- [ ComponentMetadata . Common . OriginalAttributeName ] = node . AttributeName ,
341
+ [ ComponentMetadata . Common . OriginalAttributeName ] = node . OriginalAttributeName ,
342
342
} ,
343
343
AttributeName = valueAttributeName ,
344
344
Source = node . Source ,
@@ -362,7 +362,7 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE
362
362
{
363
363
Annotations =
364
364
{
365
- [ ComponentMetadata . Common . OriginalAttributeName ] = node . AttributeName ,
365
+ [ ComponentMetadata . Common . OriginalAttributeName ] = node . OriginalAttributeName ,
366
366
} ,
367
367
AttributeName = changeAttributeName ,
368
368
Source = node . Source ,
@@ -385,7 +385,7 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE
385
385
{
386
386
Annotations =
387
387
{
388
- [ ComponentMetadata . Common . OriginalAttributeName ] = node . AttributeName ,
388
+ [ ComponentMetadata . Common . OriginalAttributeName ] = node . OriginalAttributeName ,
389
389
} ,
390
390
AttributeName = valueAttributeName ,
391
391
BoundAttribute = valueAttribute , // Might be null if it doesn't match a component attribute
@@ -405,7 +405,7 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE
405
405
{
406
406
Annotations =
407
407
{
408
- [ ComponentMetadata . Common . OriginalAttributeName ] = node . AttributeName ,
408
+ [ ComponentMetadata . Common . OriginalAttributeName ] = node . OriginalAttributeName ,
409
409
} ,
410
410
AttributeName = changeAttributeName ,
411
411
BoundAttribute = changeAttribute , // Might be null if it doesn't match a component attribute
@@ -430,7 +430,7 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE
430
430
{
431
431
Annotations =
432
432
{
433
- [ ComponentMetadata . Common . OriginalAttributeName ] = node . AttributeName ,
433
+ [ ComponentMetadata . Common . OriginalAttributeName ] = node . OriginalAttributeName ,
434
434
} ,
435
435
AttributeName = expressionAttributeName ,
436
436
BoundAttribute = expressionAttribute ,
@@ -463,7 +463,7 @@ private bool TryParseBindAttribute(
463
463
valueAttributeName = null ;
464
464
changeAttributeName = null ;
465
465
466
- if ( ! attributeName . StartsWith ( "@ bind" ) )
466
+ if ( ! attributeName . StartsWith ( "bind" ) )
467
467
{
468
468
return false ;
469
469
}
@@ -473,7 +473,7 @@ private bool TryParseBindAttribute(
473
473
changeAttributeName = GetAttributeContent ( bindEntry . BindEventNode ) ? . Content ? . Trim ( '"' ) ;
474
474
}
475
475
476
- if ( attributeName == "@ bind" )
476
+ if ( attributeName == "bind" )
477
477
{
478
478
return true ;
479
479
}
@@ -591,7 +591,7 @@ private bool TryComputeAttributeNames(
591
591
592
592
private bool TryGetFormatNode (
593
593
IntermediateNode node ,
594
- TagHelperPropertyIntermediateNode attributeNode ,
594
+ TagHelperDirectiveAttributeIntermediateNode attributeNode ,
595
595
string valueAttributeName ,
596
596
out TagHelperPropertyIntermediateNode formatNode )
597
597
{
@@ -807,16 +807,16 @@ private class BindEntry
807
807
public BindEntry ( IntermediateNodeReference bindNodeReference )
808
808
{
809
809
BindNodeReference = bindNodeReference ;
810
- BindNode = ( TagHelperPropertyIntermediateNode ) bindNodeReference . Node ;
810
+ BindNode = ( TagHelperDirectiveAttributeIntermediateNode ) bindNodeReference . Node ;
811
811
}
812
812
813
813
public IntermediateNodeReference BindNodeReference { get ; }
814
814
815
- public TagHelperPropertyIntermediateNode BindNode { get ; }
815
+ public TagHelperDirectiveAttributeIntermediateNode BindNode { get ; }
816
816
817
- public TagHelperAttributeParameterIntermediateNode BindEventNode { get ; set ; }
817
+ public TagHelperDirectiveAttributeParameterIntermediateNode BindEventNode { get ; set ; }
818
818
819
- public TagHelperAttributeParameterIntermediateNode BindFormatNode { get ; set ; }
819
+ public TagHelperDirectiveAttributeParameterIntermediateNode BindFormatNode { get ; set ; }
820
820
}
821
821
}
822
822
}
0 commit comments