@@ -97,28 +97,37 @@ private bool HasAcceptableExportField(string key, HashtableAst hast, string scri
97
97
extent = null ;
98
98
foreach ( var pair in hast . KeyValuePairs )
99
99
{
100
- if ( key . Equals ( pair . Item1 . Extent . Text . Trim ( ) , StringComparison . OrdinalIgnoreCase ) )
100
+ if ( pair . Item1 is StringConstantExpressionAst
101
+ && key . Equals ( ( pair . Item1 as StringConstantExpressionAst ) . Value ,
102
+ StringComparison . OrdinalIgnoreCase ) )
101
103
{
102
- // checks if the right hand side of the assignment is an array.
103
- var arrayAst = pair . Item2 . Find ( x => x is ArrayLiteralAst || x is ArrayExpressionAst , true ) ;
104
- if ( arrayAst == null )
105
- {
106
- extent = pair . Item2 . Extent ;
107
- return false ;
108
- }
109
- else
104
+ //checks for wildcard in the entry.
105
+ var elementWithWildcard = pair . Item2 . Find ( x => x is StringConstantExpressionAst
106
+ && WildcardPattern . ContainsWildcardCharacters ( ( x as StringConstantExpressionAst ) . Value ) , false ) ;
107
+
108
+ if ( elementWithWildcard == null )
110
109
{
111
- //checks if any entry within the array has a wildcard.
112
- var elementWithWildcard = arrayAst . Find ( x => x is StringConstantExpressionAst
113
- && x . Extent . Text . Contains ( "*" ) , false ) ;
114
- if ( elementWithWildcard != null )
110
+ //checks for $null in the entry.
111
+ var nullAst = pair . Item2 . Find ( x => x is VariableExpressionAst
112
+ && ( x as VariableExpressionAst ) . ToString ( ) . Equals ( "$null" , StringComparison . OrdinalIgnoreCase ) , false ) ;
113
+
114
+ if ( nullAst == null )
115
+ {
116
+ return true ;
117
+ }
118
+ else
115
119
{
116
- extent = elementWithWildcard . Extent ;
120
+ extent = nullAst . Extent ;
117
121
return false ;
118
- }
119
- return true ;
122
+ }
120
123
}
124
+ else
125
+ {
126
+ extent = elementWithWildcard . Extent ;
127
+ return false ;
128
+ }
121
129
}
130
+
122
131
}
123
132
return true ;
124
133
}
0 commit comments