@@ -7851,6 +7851,26 @@ public MemberExpressionAst(IScriptExtent extent, ExpressionAst expression, Comma
78517851 this . Static = @static ;
78527852 }
78537853
7854+ /// <summary>
7855+ /// Initializes a new instance of the <see cref="MemberExpressionAst"/> class.
7856+ /// </summary>
7857+ /// <param name="extent">
7858+ /// The extent of the expression, starting with the expression before the operator '.', '::' or '?.' and ending after
7859+ /// membername or expression naming the member.
7860+ /// </param>
7861+ /// <param name="expression">The expression before the member access operator '.', '::' or '?.'.</param>
7862+ /// <param name="member">The name or expression naming the member to access.</param>
7863+ /// <param name="static">True if the '::' operator was used, false if '.' or '?.' is used.</param>
7864+ /// <param name="nullConditional">True if '?.' used.</param>
7865+ /// <exception cref="PSArgumentNullException">
7866+ /// If <paramref name="extent"/>, <paramref name="expression"/>, or <paramref name="member"/> is null.
7867+ /// </exception>
7868+ public MemberExpressionAst ( IScriptExtent extent , ExpressionAst expression , CommandElementAst member , bool @static , bool nullConditional )
7869+ : this ( extent , expression , member , @static )
7870+ {
7871+ this . NullConditional = nullConditional ;
7872+ }
7873+
78547874 /// <summary>
78557875 /// The expression that produces the value to retrieve the member from. This property is never null.
78567876 /// </summary>
@@ -7866,14 +7886,19 @@ public MemberExpressionAst(IScriptExtent extent, ExpressionAst expression, Comma
78667886 /// </summary>
78677887 public bool Static { get ; private set ; }
78687888
7889+ /// <summary>
7890+ /// Gets a value indicating true if the operator used is ?. or ?[].
7891+ /// </summary>
7892+ public bool NullConditional { get ; protected set ; }
7893+
78697894 /// <summary>
78707895 /// Copy the MemberExpressionAst instance.
78717896 /// </summary>
78727897 public override Ast Copy ( )
78737898 {
78747899 var newExpression = CopyElement ( this . Expression ) ;
78757900 var newMember = CopyElement ( this . Member ) ;
7876- return new MemberExpressionAst ( this . Extent , newExpression , newMember , this . Static ) ;
7901+ return new MemberExpressionAst ( this . Extent , newExpression , newMember , this . Static , this . NullConditional ) ;
78777902 }
78787903
78797904 #region Visitors
@@ -7915,7 +7940,7 @@ public class InvokeMemberExpressionAst : MemberExpressionAst, ISupportsAssignmen
79157940 /// The extent of the expression, starting with the expression before the invocation operator and ending with the
79167941 /// closing paren after the arguments.
79177942 /// </param>
7918- /// <param name="expression">The expression before the invocation operator ('.' or '::').</param>
7943+ /// <param name="expression">The expression before the invocation operator ('.', '::').</param>
79197944 /// <param name="method">The method to invoke.</param>
79207945 /// <param name="arguments">The arguments to pass to the method.</param>
79217946 /// <param name="static">
@@ -7934,6 +7959,29 @@ public InvokeMemberExpressionAst(IScriptExtent extent, ExpressionAst expression,
79347959 }
79357960 }
79367961
7962+ /// <summary>
7963+ /// Initializes a new instance of the <see cref="InvokeMemberExpressionAst"/> class.
7964+ /// </summary>
7965+ /// <param name="extent">
7966+ /// The extent of the expression, starting with the expression before the invocation operator and ending with the
7967+ /// closing paren after the arguments.
7968+ /// </param>
7969+ /// <param name="expression">The expression before the invocation operator ('.', '::' or '?.').</param>
7970+ /// <param name="method">The method to invoke.</param>
7971+ /// <param name="arguments">The arguments to pass to the method.</param>
7972+ /// <param name="static">
7973+ /// True if the invocation is for a static method, using '::', false if invoking a method on an instance using '.' or '?.'.
7974+ /// </param>
7975+ /// <param name="nullConditional">True if the operator used is '?.'.</param>
7976+ /// <exception cref="PSArgumentNullException">
7977+ /// If <paramref name="extent"/> is null.
7978+ /// </exception>
7979+ public InvokeMemberExpressionAst ( IScriptExtent extent , ExpressionAst expression , CommandElementAst method , IEnumerable < ExpressionAst > arguments , bool @static , bool nullConditional )
7980+ : this ( extent , expression , method , arguments , @static )
7981+ {
7982+ this . NullConditional = nullConditional ;
7983+ }
7984+
79377985 /// <summary>
79387986 /// The non-empty collection of arguments to pass when invoking the method, or null if no arguments were specified.
79397987 /// </summary>
@@ -7947,7 +7995,7 @@ public override Ast Copy()
79477995 var newExpression = CopyElement ( this . Expression ) ;
79487996 var newMethod = CopyElement ( this . Member ) ;
79497997 var newArguments = CopyElements ( this . Arguments ) ;
7950- return new InvokeMemberExpressionAst ( this . Extent , newExpression , newMethod , newArguments , this . Static ) ;
7998+ return new InvokeMemberExpressionAst ( this . Extent , newExpression , newMethod , newArguments , this . Static , this . NullConditional ) ;
79517999 }
79528000
79538001 #region Visitors
@@ -10220,6 +10268,22 @@ public IndexExpressionAst(IScriptExtent extent, ExpressionAst target, Expression
1022010268 SetParent ( index ) ;
1022110269 }
1022210270
10271+ /// <summary>
10272+ /// Initializes a new instance of the <see cref="IndexExpressionAst"/> class.
10273+ /// </summary>
10274+ /// <param name="extent">The extent of the expression.</param>
10275+ /// <param name="target">The expression being indexed.</param>
10276+ /// <param name="index">The index expression.</param>
10277+ /// <param name="nullConditional">Access the index only if the target is not null.</param>
10278+ /// <exception cref="PSArgumentNullException">
10279+ /// If <paramref name="extent"/>, <paramref name="target"/>, or <paramref name="index"/> is null.
10280+ /// </exception>
10281+ public IndexExpressionAst ( IScriptExtent extent , ExpressionAst target , ExpressionAst index , bool nullConditional )
10282+ : this ( extent , target , index )
10283+ {
10284+ this . NullConditional = nullConditional ;
10285+ }
10286+
1022310287 /// <summary>
1022410288 /// Return the ast for the expression being indexed. This value is never null.
1022510289 /// </summary>
@@ -10230,14 +10294,19 @@ public IndexExpressionAst(IScriptExtent extent, ExpressionAst target, Expression
1023010294 /// </summary>
1023110295 public ExpressionAst Index { get ; private set ; }
1023210296
10297+ /// <summary>
10298+ /// Gets a value indicating whether ?[] operator is being used.
10299+ /// </summary>
10300+ public bool NullConditional { get ; private set ; }
10301+
1023310302 /// <summary>
1023410303 /// Copy the IndexExpressionAst instance.
1023510304 /// </summary>
1023610305 public override Ast Copy ( )
1023710306 {
1023810307 var newTarget = CopyElement ( this . Target ) ;
1023910308 var newIndex = CopyElement ( this . Index ) ;
10240- return new IndexExpressionAst ( this . Extent , newTarget , newIndex ) ;
10309+ return new IndexExpressionAst ( this . Extent , newTarget , newIndex , this . NullConditional ) ;
1024110310 }
1024210311
1024310312 #region Visitors
0 commit comments