@@ -26,42 +26,33 @@ public ListNode(ParsingContext context, OpenApiDiagnostic diagnostic, YamlSequen
26
26
27
27
public override List < T > CreateList < T > ( Func < MapNode , T > map )
28
28
{
29
- var yamlSequence = _nodeList ;
30
- if ( yamlSequence == null )
29
+ if ( _nodeList == null )
31
30
{
32
31
throw new OpenApiException (
33
32
$ "Expected list at line { _nodeList . Start . Line } while parsing { typeof ( T ) . Name } ") ;
34
33
}
35
34
36
- return yamlSequence . Select ( n => map ( new MapNode ( Context , Diagnostic , n as YamlMappingNode ) ) )
35
+ return _nodeList . Select ( n => map ( new MapNode ( Context , Diagnostic , n as YamlMappingNode ) ) )
37
36
. Where ( i => i != null )
38
37
. ToList ( ) ;
39
38
}
40
39
41
40
public override List < IOpenApiAny > CreateListOfAny ( )
42
41
{
43
- var yamlSequence = _nodeList ;
44
- if ( yamlSequence == null )
45
- {
46
- throw new OpenApiException (
47
- $ "Expected list at line { _nodeList . Start . Line } ") ;
48
- }
49
-
50
- return yamlSequence . Select ( n => ParseNode . Create ( Context , Diagnostic , n ) . CreateAny ( ) )
42
+ return _nodeList . Select ( n => ParseNode . Create ( Context , Diagnostic , n ) . CreateAny ( ) )
51
43
. Where ( i => i != null )
52
44
. ToList ( ) ;
53
45
}
54
46
55
47
public override List < T > CreateSimpleList < T > ( Func < ValueNode , T > map )
56
48
{
57
- var yamlSequence = _nodeList ;
58
- if ( yamlSequence == null )
49
+ if ( _nodeList == null )
59
50
{
60
51
throw new OpenApiException (
61
52
$ "Expected list at line { _nodeList . Start . Line } while parsing { typeof ( T ) . Name } ") ;
62
53
}
63
54
64
- return yamlSequence . Select ( n => map ( new ValueNode ( Context , Diagnostic , ( YamlScalarNode ) n ) ) ) . ToList ( ) ;
55
+ return _nodeList . Select ( n => map ( new ValueNode ( Context , Diagnostic , ( YamlScalarNode ) n ) ) ) . ToList ( ) ;
65
56
}
66
57
67
58
public IEnumerator < ParseNode > GetEnumerator ( )
@@ -88,10 +79,5 @@ public override IOpenApiAny CreateAny()
88
79
89
80
return array ;
90
81
}
91
-
92
- //public override string GetScalarValue()
93
- //{
94
- // throw new OpenApiException()
95
- //}
96
82
}
97
83
}
0 commit comments