diff options
author | Jon Hanna <jon@hackcraft.net> | 2017-04-05 02:19:16 +0300 |
---|---|---|
committer | Jon Hanna <jon@hackcraft.net> | 2017-04-05 02:44:33 +0300 |
commit | 77e2f76af7aef5c3ce430ae8f6f799386c008b2a (patch) | |
tree | d71f2a9eb1cab69549527b776cb7f119e1f5fb54 /src | |
parent | 38532f77778f7a1a240c92b269258c322e9caa68 (diff) |
Make Expr.Kind non-virtual and set from ctor.
Diffstat (limited to 'src')
39 files changed, 103 insertions, 107 deletions
diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs index 0bd2c7f96d..934115acdd 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs @@ -21,19 +21,10 @@ namespace Microsoft.CSharp.RuntimeBinder { public readonly Expression Expression; public ExpressionExpr(Expression e) + : base(0) { Expression = e; } - - [ExcludeFromCodeCoverage] - public override ExpressionKind Kind - { - get - { - Debug.Fail("Should not be called"); - return 0; - } - } } private readonly Dictionary<ExprCall, Expression> _DictionaryOfParameters; diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayIndex.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayIndex.cs index 6af1003d20..a259838b19 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayIndex.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayIndex.cs @@ -7,14 +7,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprArrayIndex : ExprWithType { public ExprArrayIndex(CType type) - : base(type) + : base(ExpressionKind.EK_ARRAYINDEX, type) { } public Expr Array { get; set; } public Expr Index { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_ARRAYINDEX; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayInitialization.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayInitialization.cs index f521e60101..047a2f54c5 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayInitialization.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayInitialization.cs @@ -7,7 +7,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprArrayInit : ExprWithType { public ExprArrayInit(CType type) - : base(type) + : base(ExpressionKind.EK_ARRINIT, type) { } @@ -21,7 +21,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public int DimensionSize { get; set; } public bool GeneratedForParamArray { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_ARRINIT; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayLength.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayLength.cs index e737caeea6..d9579fe38c 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayLength.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayLength.cs @@ -7,12 +7,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprArrayLength : ExprWithType { public ExprArrayLength(CType type) - : base(type) + : base(ExpressionKind.EK_ARRAYLENGTH, type) { } public Expr Array { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_ARRAYLENGTH; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Assignment.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Assignment.cs index a8c8c93de3..931fe033c8 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Assignment.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Assignment.cs @@ -6,12 +6,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprAssignment : Expr { + public ExprAssignment() + : base(ExpressionKind.EK_ASSIGNMENT) + { + } + public Expr LHS { get; set; } public Expr RHS { get; set; } public override CType Type => LHS.Type; - - public override ExpressionKind Kind => ExpressionKind.EK_ASSIGNMENT; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Block.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Block.cs index 2a83f1ceee..5b4448ce16 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Block.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Block.cs @@ -6,10 +6,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprBlock : ExprStatement { + public ExprBlock() + : base(ExpressionKind.EK_BLOCK) + { + } + public ExprStatement OptionalStatements { get; set; } public Scope OptionalScopeSymbol { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_BLOCK; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/BoundAnonymousFunction.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/BoundAnonymousFunction.cs index 0c22bf3ddb..74cccf96c6 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/BoundAnonymousFunction.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/BoundAnonymousFunction.cs @@ -11,7 +11,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private Scope _argumentScope; public ExprBoundLambda(CType type) - : base(type) + : base(ExpressionKind.EK_BOUNDLAMBDA, type) { Debug.Assert(type == null || type.isDelegateType()); } @@ -36,7 +36,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics _argumentScope = value; } } - - public override ExpressionKind Kind => ExpressionKind.EK_BOUNDLAMBDA; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Call.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Call.cs index 048fb52ba8..13ca161a5d 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Call.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Call.cs @@ -7,7 +7,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprCall : ExprWithType, IExprWithArgs { public ExprCall(CType type) - : base(type) + : base(ExpressionKind.EK_CALL, type) { } @@ -38,7 +38,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics MemberGroup?.SetMismatchedStaticBit(); base.SetMismatchedStaticBit(); } - - public override ExpressionKind Kind => ExpressionKind.EK_CALL; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Cast.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Cast.cs index 745d72a282..5a73cb88d0 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Cast.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Cast.cs @@ -6,6 +6,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprCast : Expr { + public ExprCast() + : base(ExpressionKind.EK_CAST) + { + } + public Expr Argument { get; set; } public ExprClass DestinationType { get; set; } @@ -13,7 +18,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public override CType Type => DestinationType.Type; public bool IsBoxingCast => (Flags & (EXPRFLAG.EXF_BOX | EXPRFLAG.EXF_FORCE_BOX)) != 0; - - public override ExpressionKind Kind => ExpressionKind.EK_CAST; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Class.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Class.cs index c247b00984..64e6e48985 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Class.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Class.cs @@ -7,10 +7,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprClass : ExprWithType { public ExprClass(CType type) - : base(type) + : base(ExpressionKind.EK_CLASS, type) { } - - public override ExpressionKind Kind => ExpressionKind.EK_CLASS; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/CompoundOperator.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/CompoundOperator.cs index 3341958440..4bcab09343 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/CompoundOperator.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/CompoundOperator.cs @@ -7,26 +7,22 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprMultiGet : ExprWithType { public ExprMultiGet(CType type) - : base(type) + : base(ExpressionKind.EK_MULTIGET, type) { } public ExprMulti OptionalMulti { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_MULTIGET; } internal sealed class ExprMulti : ExprWithType { public ExprMulti(CType type) - : base(type) + : base(ExpressionKind.EK_MULTI, type) { } public Expr Left { get; set; } public Expr Operator { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_MULTI; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Concatenate.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Concatenate.cs index b0184be907..4eaac944a3 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Concatenate.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Concatenate.cs @@ -7,14 +7,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprConcat : ExprWithType { public ExprConcat(CType type) - : base(type) + : base(ExpressionKind.EK_CONCAT ,type) { } public Expr FirstArgument { get; set; } public Expr SecondArgument { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_CONCAT; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ConditionalOperator.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ConditionalOperator.cs index bfb409ae1b..053a11a902 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ConditionalOperator.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ConditionalOperator.cs @@ -6,12 +6,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprQuestionMark : Expr { + public ExprQuestionMark() + : base(ExpressionKind.EK_QUESTIONMARK) + { + } + public Expr TestExpression { get; set; } public ExprBinOp Consequence { get; set; } public override CType Type => Consequence.Type ?? Consequence.OptionalLeftChild.Type; - - public override ExpressionKind Kind => ExpressionKind.EK_QUESTIONMARK; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Constant.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Constant.cs index 2a33a8ba7c..4f0d143652 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Constant.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Constant.cs @@ -9,7 +9,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprConstant : ExprWithType { public ExprConstant(CType type) - : base(type) + : base(ExpressionKind.EK_CONSTANT, type) { } @@ -44,7 +44,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } } } - - public override ExpressionKind Kind => ExpressionKind.EK_CONSTANT; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/EXPR.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/EXPR.cs index a4540bdf00..04e233b4eb 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/EXPR.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/EXPR.cs @@ -6,11 +6,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal abstract class Expr { + protected Expr(ExpressionKind kind) + { + Kind = kind; + } + internal object RuntimeObject { get; set; } internal CType RuntimeObjectActualType { get; set; } - public abstract ExpressionKind Kind { get; } + public ExpressionKind Kind { get; } public EXPRFLAG Flags { get; set; } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Event.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Event.cs index 16b4b8f47c..08eca6cac4 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Event.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Event.cs @@ -7,14 +7,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprEvent : ExprWithType, IExprWithObject { public ExprEvent(CType type) - : base(type) + : base(ExpressionKind.EK_EVENT, type) { } public Expr OptionalObject { get; set; } public EventWithType EventWithType { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_EVENT; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprOperator.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprOperator.cs index 8d381219a4..c92f329932 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprOperator.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprOperator.cs @@ -8,13 +8,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal abstract class ExprOperator : ExprWithType { - public override ExpressionKind Kind { get; } - protected ExprOperator(ExpressionKind kind, CType type) - : base(type) + : base(kind, type) { Debug.Assert(kind.isUnaryOperator() || kind > ExpressionKind.EK_TypeLim); - Kind = kind; } public Expr OptionalUserDefinedCall { get; set; } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprWithType.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprWithType.cs index 47983795bd..554386c724 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprWithType.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprWithType.cs @@ -6,7 +6,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal abstract class ExprWithType : Expr { - protected ExprWithType(CType type) + protected ExprWithType(ExpressionKind kind, CType type) + : base(kind) { Type = type; } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Field.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Field.cs index 265dccb640..c1560ee0ea 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Field.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Field.cs @@ -7,14 +7,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprField : ExprWithType, IExprWithObject { public ExprField(CType type) - : base(type) + : base(ExpressionKind.EK_FIELD, type) { } public Expr OptionalObject { get; set; } public FieldWithType FieldWithType { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_FIELD; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/FieldInfo.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/FieldInfo.cs index cb3130c6fb..32c835db5e 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/FieldInfo.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/FieldInfo.cs @@ -7,7 +7,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprFieldInfo : ExprWithType { public ExprFieldInfo(FieldSymbol f, AggregateType ft, CType type) - : base(type) + : base(ExpressionKind.EK_FIELDINFO, type) { Field = f; FieldType = ft; @@ -16,7 +16,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public FieldSymbol Field { get; } public AggregateType FieldType { get; } - - public override ExpressionKind Kind => ExpressionKind.EK_FIELDINFO; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/HoistedLocal.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/HoistedLocal.cs index fc9a09b046..cf1c1d3536 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/HoistedLocal.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/HoistedLocal.cs @@ -7,10 +7,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprHoistedLocalExpr : ExprWithType { public ExprHoistedLocalExpr(CType type) - : base(type) + : base(ExpressionKind.EK_HOISTEDLOCALEXPR, type) { } - - public override ExpressionKind Kind => ExpressionKind.EK_HOISTEDLOCALEXPR; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/List.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/List.cs index eee948a6f5..421938a4ec 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/List.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/List.cs @@ -6,10 +6,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprList : Expr { + public ExprList() + : base(ExpressionKind.EK_LIST) + { + } + public Expr OptionalElement { get; set; } public Expr OptionalNextListNode { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_LIST; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/LocalVariable.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/LocalVariable.cs index 5ee2df4618..f3c56ca46e 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/LocalVariable.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/LocalVariable.cs @@ -2,14 +2,25 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Diagnostics; + namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal class ExprLocal : Expr { + public ExprLocal() + : base(ExpressionKind.EK_LOCAL) + { + } + + protected ExprLocal(ExpressionKind kind) + : base(kind) + { + Debug.Assert(kind == ExpressionKind.EK_THISPOINTER); + } + public LocalVariableSymbol Local { get; set; } public override CType Type => Local?.GetType(); - - public override ExpressionKind Kind => ExpressionKind.EK_LOCAL; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MemberGroup.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MemberGroup.cs index 82130ca59b..f1a989944a 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MemberGroup.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MemberGroup.cs @@ -9,7 +9,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprMemberGroup : ExprWithType, IExprWithObject { public ExprMemberGroup(CType type) - : base(type) + : base(ExpressionKind.EK_MEMGRP, type) { } @@ -42,7 +42,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public bool IsDelegate => (Flags & EXPRFLAG.EXF_DELEGATE) != 0; public void SetInaccessibleBit() => SetError(); - - public override ExpressionKind Kind => ExpressionKind.EK_MEMGRP; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodInfo.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodInfo.cs index a068b84f6f..547cec6ed7 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodInfo.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodInfo.cs @@ -7,12 +7,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprMethodInfo : ExprWithType { public ExprMethodInfo(CType type) - : base(type) + : base(ExpressionKind.EK_METHODINFO, type) { } public MethWithInst Method { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_METHODINFO; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodReference.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodReference.cs index 3b7daaef84..0190da5c6c 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodReference.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodReference.cs @@ -7,14 +7,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprFuncPtr : ExprWithType, IExprWithObject { public ExprFuncPtr(CType type) - : base(type) + : base(ExpressionKind.EK_FUNCPTR, type) { } public MethWithInst MethWithInst { get; set; } public Expr OptionalObject { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_FUNCPTR; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/NamedArgumentSpecification.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/NamedArgumentSpecification.cs index b800ca8e60..4b750db2db 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/NamedArgumentSpecification.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/NamedArgumentSpecification.cs @@ -8,12 +8,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprNamedArgumentSpecification : Expr { + public ExprNamedArgumentSpecification() + : base(ExpressionKind.EK_NamedArgumentSpecification) + { + } + public Name Name { get; set; } public Expr Value { get; set; } public override CType Type => Value.Type; - - public override ExpressionKind Kind => ExpressionKind.EK_NamedArgumentSpecification; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Property.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Property.cs index c2527cb89f..f6edd16afc 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Property.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Property.cs @@ -15,7 +15,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // "through" type to ensure that protected semantics are correctly enforced.) public ExprProperty(CType type) - : base(type) + : base(ExpressionKind.EK_PROP, type) { } @@ -38,7 +38,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public bool IsBaseCall => 0 != (Flags & EXPRFLAG.EXF_BASECALL); SymWithType IExprWithArgs.GetSymWithType() => PropWithTypeSlot; - - public override ExpressionKind Kind => ExpressionKind.EK_PROP; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/PropertyInfo.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/PropertyInfo.cs index 465e878fec..e62a638d96 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/PropertyInfo.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/PropertyInfo.cs @@ -7,12 +7,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprPropertyInfo : ExprWithType { public ExprPropertyInfo(CType type) - : base(type) + : base(ExpressionKind.EK_PROPERTYINFO, type) { } public PropWithType Property { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_PROPERTYINFO; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Return.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Return.cs index c0be3dc5a3..5e47267efa 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Return.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Return.cs @@ -6,9 +6,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprReturn : ExprStatement, IExprWithObject { + public ExprReturn() + : base(ExpressionKind.EK_RETURN) + { + } + // Return object is optional because of void returns. public Expr OptionalObject { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_RETURN; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Statement.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Statement.cs index 2ea0893d5b..c007a01641 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Statement.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Statement.cs @@ -6,6 +6,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal abstract class ExprStatement : Expr { + public ExprStatement(ExpressionKind kind) + : base(kind) + { + } + public ExprStatement OptionalNextStatement { get; set; } } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Temporary.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Temporary.cs index ef44c82842..41d67d398c 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Temporary.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Temporary.cs @@ -6,10 +6,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprWrap : Expr { + public ExprWrap() + : base(ExpressionKind.EK_WRAP) + { + } public Expr OptionalExpression { get; set; } public override CType Type => OptionalExpression?.Type; - - public override ExpressionKind Kind => ExpressionKind.EK_WRAP; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/This.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/This.cs index 90e8f0cfd6..ceaf44e76a 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/This.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/This.cs @@ -6,6 +6,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprThisPointer : ExprLocal { - public override ExpressionKind Kind => ExpressionKind.EK_THISPOINTER; + public ExprThisPointer() + : base(ExpressionKind.EK_THISPOINTER) + { + } } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeArguments.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeArguments.cs index a91105de46..ebab8c81b9 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeArguments.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeArguments.cs @@ -13,6 +13,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { public Expr OptionalElements { get; set; } - public override ExpressionKind Kind => ExpressionKind.EK_TYPEARGUMENTS; + public ExprTypeArguments() + : base(ExpressionKind.EK_TYPEARGUMENTS) + { + } } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeOf.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeOf.cs index af6e74c45b..848f5cdf98 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeOf.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeOf.cs @@ -7,12 +7,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprTypeOf : ExprWithType { public ExprTypeOf(CType type) - : base(type) + : base(ExpressionKind.EK_TYPEOF, type) { } public ExprClass SourceType { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_TYPEOF; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UnboundAnonymousFunction.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UnboundAnonymousFunction.cs index d888f7e087..b2af58229a 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UnboundAnonymousFunction.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UnboundAnonymousFunction.cs @@ -7,10 +7,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprUnboundLambda : ExprWithType { public ExprUnboundLambda(CType type) - : base(type) + : base(ExpressionKind.EK_UNBOUNDLAMBDA, type) { } - - public override ExpressionKind Kind => ExpressionKind.EK_UNBOUNDLAMBDA; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedConversion.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedConversion.cs index 8a568698fd..68e80bf180 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedConversion.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedConversion.cs @@ -6,6 +6,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprUserDefinedConversion : Expr { + public ExprUserDefinedConversion() + : base(ExpressionKind.EK_USERDEFINEDCONVERSION) + { + + } public Expr Argument { get; set; } public Expr UserDefinedCall { get; set; } @@ -13,7 +18,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public override CType Type => UserDefinedCall.Type; public MethWithInst UserDefinedCallMethod { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_USERDEFINEDCONVERSION; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedLogicalOperator.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedLogicalOperator.cs index 370a2174d0..15db5b7752 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedLogicalOperator.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedLogicalOperator.cs @@ -7,7 +7,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprUserLogicalOp : ExprWithType { public ExprUserLogicalOp(CType type) - : base(type) + : base(ExpressionKind.EK_USERLOGOP, type) { } @@ -16,7 +16,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public ExprCall OperatorCall { get; set; } public Expr FirstOperandToExamine { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_USERLOGOP; } } diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ZeroInitialize.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ZeroInitialize.cs index 27a2958161..f1f21cee09 100644 --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ZeroInitialize.cs +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ZeroInitialize.cs @@ -7,7 +7,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class ExprZeroInit : ExprWithType { public ExprZeroInit(CType type) - : base(type) + : base(ExpressionKind.EK_ZEROINIT, type) { } @@ -16,7 +16,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public Expr OptionalConstructorCall { get; set; } public bool IsConstructor { get; set; } - - public override ExpressionKind Kind => ExpressionKind.EK_ZEROINIT; } } |