diff options
| author | unmush <unmush@hashbang.sh> | 2024-11-26 13:42:39 +0200 |
|---|---|---|
| committer | Efraim Flashner <efraim@flashner.co.il> | 2024-12-22 15:37:35 +0200 |
| commit | b0ef15d7f41ace2d15cbef64b85d92fa20d154d3 (patch) | |
| tree | b0629259b9196a936949646a1515246b1da78256 | |
| parent | e87bd7473ad41049240ebe354f30e310363cb4db (diff) | |
gnu: Add mono-pre-5.8.0.
* gnu/packages/dotnet.scm (mono-pre-5.8.0-external-repo-specs,
mono-pre-5.8.0): New variables.
* gnu/packages/patches/corefx-mono-pre-5.8.0-patches.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register new patch.
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Change-Id: I36d66e2ea8850e1250af82f3fbbb08f7c62fbeb3
| -rw-r--r-- | gnu/local.mk | 1 | ||||
| -rw-r--r-- | gnu/packages/dotnet.scm | 79 | ||||
| -rw-r--r-- | gnu/packages/patches/corefx-mono-pre-5.8.0-patches.patch | 1349 |
3 files changed, 1429 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index 8022b68a393..926c1ddf311 100644 --- a/gnu/local.mk +++ b/gnu/local.mk | |||
| @@ -1122,6 +1122,7 @@ dist_patch_DATA = \ | |||
| 1122 | %D%/packages/patches/cool-retro-term-wctype.patch \ | 1122 | %D%/packages/patches/cool-retro-term-wctype.patch \ |
| 1123 | %D%/packages/patches/coq-autosubst-1.8-remove-deprecated-files.patch \ | 1123 | %D%/packages/patches/coq-autosubst-1.8-remove-deprecated-files.patch \ |
| 1124 | %D%/packages/patches/corefx-mono-5.4.0-patches.patch \ | 1124 | %D%/packages/patches/corefx-mono-5.4.0-patches.patch \ |
| 1125 | %D%/packages/patches/corefx-mono-pre-5.8.0-patches.patch \ | ||
| 1125 | %D%/packages/patches/coreutils-gnulib-tests.patch \ | 1126 | %D%/packages/patches/coreutils-gnulib-tests.patch \ |
| 1126 | %D%/packages/patches/cppcheck-disable-char-signedness-test.patch \ | 1127 | %D%/packages/patches/cppcheck-disable-char-signedness-test.patch \ |
| 1127 | %D%/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch\ | 1128 | %D%/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch\ |
diff --git a/gnu/packages/dotnet.scm b/gnu/packages/dotnet.scm index fa67b6d385e..cd6751a51a8 100644 --- a/gnu/packages/dotnet.scm +++ b/gnu/packages/dotnet.scm | |||
| @@ -1223,3 +1223,82 @@ unused0:"))))) | |||
| 1223 | (patches (search-patches "mono-5.4.0-patches.patch")))) | 1223 | (patches (search-patches "mono-5.4.0-patches.patch")))) |
| 1224 | (native-inputs (modify-inputs (package-native-inputs mono-5.2.0) | 1224 | (native-inputs (modify-inputs (package-native-inputs mono-5.2.0) |
| 1225 | (replace "mono" mono-5.2.0))))) | 1225 | (replace "mono" mono-5.2.0))))) |
| 1226 | |||
| 1227 | (define mono-pre-5.8.0-external-repo-specs | ||
| 1228 | '(("api-doc-tools" "d03e819838c6241f92f90655cb448cc47c9e8791" | ||
| 1229 | "1riki79f3ig3cxigviss81dz601hn92a1gifglm0mzjbs76sf3fj" | ||
| 1230 | #:recursive? #t) | ||
| 1231 | ("api-snapshot" "e790a9b77031ef1d8ebf093ef88840edea11ed73" | ||
| 1232 | "1c4np2fqd9mpc1i1x8bsxnypacp58vkvgdwpnmvmlyjdvbj5ax6q") | ||
| 1233 | ("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299" | ||
| 1234 | "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1") | ||
| 1235 | (("reference-assemblies" "binary-reference-assemblies") | ||
| 1236 | "142cbeb62ffabf1dd9c1414d8dd76f93bcbed0c2" | ||
| 1237 | "1wkd589hgb16m5zvmp9yb57agyyryaa1jj8vhl4w20i2hp22wad9") | ||
| 1238 | ("bockbuild" "b445017309aac741a26d8c51bb0636234084bf23" | ||
| 1239 | "1jzhvavd1j0n7sy1waczgjv0kmrbr35gkzd76fhlmqvsy0sr9695") | ||
| 1240 | ("boringssl" "3e0770e18835714708860ba9fe1af04a932971ff" | ||
| 1241 | "139a0gl91a52k2r6na6ialzkqykaj1rk88zjrkaz3sdxx7nmmg6y") | ||
| 1242 | ("cecil" "c76ba7b410447fa37093150cb7bc772cba28a0ae" | ||
| 1243 | "0ydi7rn8ajqyvnj9agyn74llb4qgd9kgdcg3gajdfyb2klxx6za8") | ||
| 1244 | (("cecil" "cecil-legacy") "33d50b874fd527118bc361d83de3d494e8bb55e1" | ||
| 1245 | "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb") | ||
| 1246 | ("corefx" "74ccd8aa00d7d271191ca3b9c4f818268dc36c28" | ||
| 1247 | "0nm41qdpvj62r8bxnf92m7kimjm1i544ygdqz5a7pgc6zf99as6j" | ||
| 1248 | #:patches ("corefx-mono-pre-5.8.0-patches.patch")) | ||
| 1249 | ("corert" "48dba73801e804e89f00311da99d873f9c550278" | ||
| 1250 | "1zw47jf4cwqmaixylisxi73xf6cap41bwf9vlmpxanzxaqklzsvk") | ||
| 1251 | ("ikdasm" "3aef9cdd6013fc0620a1817f0b11d8fb90ed2e0f" | ||
| 1252 | "078cai33x8c71969iwi7hmbqdfwpicpmam2ag3k2bklpva2vnszv") | ||
| 1253 | (("ikvm-fork" "ikvm") "847e05fced5c9a41ff0f24f1f9d40d5a8a5772c1" | ||
| 1254 | "1fl9bm3lmzf8iqv3x4iqkz9fc54mwdvrxisxg2nvwwcsi4saffpi") | ||
| 1255 | ("linker" "21e445c26c69ac3a2e1441befa02d0bd105ff849" | ||
| 1256 | "1hx3ik0sg70ysc2y8jdjxm2ljql0069i05i8fp1lakx7s7z7bywc") | ||
| 1257 | ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4" | ||
| 1258 | "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s") | ||
| 1259 | (("NuGet.BuildTasks" "nuget-buildtasks") | ||
| 1260 | "8d307472ea214f2b59636431f771894dbcba7258" | ||
| 1261 | "1h1frnj0x8k7b29ic4jisch0vlpmsmghjw554pz277f2nxaidljj") | ||
| 1262 | (("NUnitLite" "nunit-lite") "690603bea98aae69fca9a65130d88591bc6cabee" | ||
| 1263 | "1f845ysjzs3yd9gcyww66dnkx484z5fknb8l0xz74sjmxk2mngwc") | ||
| 1264 | ;; ("roslyn-binaries" "80b86f340b7f6fb7afe84443214e1cbd7ff70620" | ||
| 1265 | ;; "") | ||
| 1266 | ("rx" "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e" | ||
| 1267 | "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv") | ||
| 1268 | ;; ("xunit-binaries" "d4433b0972f40cb3efaa3fbba52869bde5df8fa8" | ||
| 1269 | ;; "") | ||
| 1270 | )) | ||
| 1271 | |||
| 1272 | (define-public mono-pre-5.8.0 | ||
| 1273 | (let ((commit "d0f51b4e834042cfa593748ada942033b458cc40") | ||
| 1274 | (version "5.4.0.201") | ||
| 1275 | (revision "0")) | ||
| 1276 | (package | ||
| 1277 | (inherit mono-5.4.0) | ||
| 1278 | (version (git-version version revision commit)) | ||
| 1279 | (name "mono") | ||
| 1280 | (source (origin | ||
| 1281 | (method git-fetch) | ||
| 1282 | (uri | ||
| 1283 | (git-reference | ||
| 1284 | (url "https://gitlab.winehq.org/mono/mono.git") | ||
| 1285 | (commit commit))) | ||
| 1286 | (file-name (git-file-name name version)) | ||
| 1287 | (sha256 | ||
| 1288 | (base32 | ||
| 1289 | "0az5syk1nn9gd5imkbmpb13qm9q6ibr2d2ksdzpwsarkfyp4ic53")) | ||
| 1290 | (modules '((guix build utils) | ||
| 1291 | (ice-9 string-fun))) | ||
| 1292 | (snippet #~(begin | ||
| 1293 | #$(add-external-repos | ||
| 1294 | mono-pre-5.8.0-external-repo-specs) | ||
| 1295 | #$@prepare-mono-source-0)) | ||
| 1296 | (patches | ||
| 1297 | (search-patches "mono-5.4.0-patches.patch")))) | ||
| 1298 | (native-inputs (modify-inputs (package-native-inputs mono-5.4.0) | ||
| 1299 | (replace "mono" mono-5.4.0))) | ||
| 1300 | (arguments | ||
| 1301 | (substitute-keyword-arguments (package-arguments mono-5.4.0) | ||
| 1302 | ((#:phases phases #~%standard-phases) | ||
| 1303 | #~(modify-phases #$phases | ||
| 1304 | (delete 'patch-sub-autogen.sh-shebang)))))))) | ||
diff --git a/gnu/packages/patches/corefx-mono-pre-5.8.0-patches.patch b/gnu/packages/patches/corefx-mono-pre-5.8.0-patches.patch new file mode 100644 index 00000000000..04dcc6c5a50 --- /dev/null +++ b/gnu/packages/patches/corefx-mono-pre-5.8.0-patches.patch | |||
| @@ -0,0 +1,1349 @@ | |||
| 1 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs | ||
| 2 | index aa8afa5a1b..3a2518246a 100644 | ||
| 3 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs | ||
| 4 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs | ||
| 5 | @@ -246,8 +246,9 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 6 | ExprArrayInit arrinit; | ||
| 7 | |||
| 8 | ExprList list = (ExprList)pExpr.OptionalArguments; | ||
| 9 | - if (list.OptionalNextListNode is ExprList next) | ||
| 10 | + if (list.OptionalNextListNode is ExprList) | ||
| 11 | { | ||
| 12 | + ExprList next = (ExprList)list.OptionalNextListNode; | ||
| 13 | methinfo = (ExprMethodInfo)next.OptionalElement; | ||
| 14 | arrinit = (ExprArrayInit)next.OptionalNextListNode; | ||
| 15 | } | ||
| 16 | @@ -382,8 +383,9 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 17 | Expr nextNode = list.OptionalNextListNode; | ||
| 18 | ExprPropertyInfo propinfo; | ||
| 19 | ExprArrayInit arguments; | ||
| 20 | - if (nextNode is ExprList nextList) | ||
| 21 | + if (nextNode is ExprList) | ||
| 22 | { | ||
| 23 | + ExprList nextList = (ExprList)list.OptionalNextListNode; | ||
| 24 | propinfo = nextList.OptionalElement as ExprPropertyInfo; | ||
| 25 | arguments = nextList.OptionalNextListNode as ExprArrayInit; | ||
| 26 | } | ||
| 27 | @@ -553,8 +555,9 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 28 | list = (ExprList)list.OptionalNextListNode; | ||
| 29 | MethodInfo methodInfo; | ||
| 30 | bool bIsLifted = false; | ||
| 31 | - if (list.OptionalNextListNode is ExprList next) | ||
| 32 | + if (list.OptionalNextListNode is ExprList) | ||
| 33 | { | ||
| 34 | + ExprList next = (ExprList)list.OptionalNextListNode; | ||
| 35 | ExprConstant isLifted = (ExprConstant)next.OptionalElement; | ||
| 36 | Debug.Assert(isLifted != null); | ||
| 37 | bIsLifted = isLifted.Val.Int32Val == 1; | ||
| 38 | @@ -677,8 +680,9 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 39 | |||
| 40 | private Expression GetExpression(Expr pExpr) | ||
| 41 | { | ||
| 42 | - if (pExpr is ExprWrap wrap) | ||
| 43 | + if (pExpr is ExprWrap) | ||
| 44 | { | ||
| 45 | + ExprWrap wrap = (ExprWrap) pExpr; | ||
| 46 | return _DictionaryOfParameters[(ExprCall)wrap.OptionalExpression]; | ||
| 47 | } | ||
| 48 | else if (pExpr is ExprConstant) | ||
| 49 | @@ -875,20 +879,24 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 50 | { | ||
| 51 | for (;;) | ||
| 52 | { | ||
| 53 | - if (pExpr is ExprCast cast) | ||
| 54 | + if (pExpr is ExprCast) | ||
| 55 | { | ||
| 56 | + ExprCast cast = (ExprCast) pExpr; | ||
| 57 | pExpr = cast.Argument; | ||
| 58 | } | ||
| 59 | - else if (pExpr is ExprTypeOf typeOf) | ||
| 60 | + else if (pExpr is ExprTypeOf) | ||
| 61 | { | ||
| 62 | + ExprTypeOf typeOf = (ExprTypeOf) pExpr; | ||
| 63 | return typeOf.SourceType.Type.AssociatedSystemType; | ||
| 64 | } | ||
| 65 | - else if (pExpr is ExprMethodInfo methodInfo) | ||
| 66 | + else if (pExpr is ExprMethodInfo) | ||
| 67 | { | ||
| 68 | + ExprMethodInfo methodInfo = (ExprMethodInfo) pExpr; | ||
| 69 | return GetMethodInfoFromExpr(methodInfo); | ||
| 70 | } | ||
| 71 | - else if (pExpr is ExprConstant constant) | ||
| 72 | + else if (pExpr is ExprConstant) | ||
| 73 | { | ||
| 74 | + ExprConstant constant = (ExprConstant) pExpr; | ||
| 75 | ConstVal val = constant.Val; | ||
| 76 | CType underlyingType = pExpr.Type; | ||
| 77 | object objval; | ||
| 78 | @@ -954,8 +962,9 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 79 | |||
| 80 | return pExpr.Type.isEnumType() ? Enum.ToObject(pExpr.Type.AssociatedSystemType, objval) : objval; | ||
| 81 | } | ||
| 82 | - else if (pExpr is ExprZeroInit zeroInit) | ||
| 83 | + else if (pExpr is ExprZeroInit) | ||
| 84 | { | ||
| 85 | + ExprZeroInit zeroInit = (ExprZeroInit) pExpr; | ||
| 86 | if ((pExpr = zeroInit.OptionalArgument) == null) | ||
| 87 | { | ||
| 88 | return Activator.CreateInstance(zeroInit.Type.AssociatedSystemType); | ||
| 89 | @@ -981,8 +990,9 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 90 | Expr p = list; | ||
| 91 | while (list != null) | ||
| 92 | { | ||
| 93 | - if (list is ExprList pList) | ||
| 94 | + if (list is ExprList) | ||
| 95 | { | ||
| 96 | + ExprList pList = (ExprList) list; | ||
| 97 | p = pList.OptionalElement; | ||
| 98 | list = pList.OptionalNextListNode; | ||
| 99 | } | ||
| 100 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinder.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinder.cs | ||
| 101 | index a623bfc0bf..4a742156b9 100644 | ||
| 102 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinder.cs | ||
| 103 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinder.cs | ||
| 104 | @@ -189,7 +189,8 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 105 | LocalVariableSymbol[] locals = PopulateLocalScope(payload, pScope, arguments, parameters); | ||
| 106 | |||
| 107 | // (1.5) - Check to see if we need to defer. | ||
| 108 | - if (DeferBinding(payload, arguments, args, locals, out DynamicMetaObject o)) | ||
| 109 | + DynamicMetaObject o; | ||
| 110 | + if (DeferBinding(payload, arguments, args, locals, out o)) | ||
| 111 | { | ||
| 112 | deferredBinding = o; | ||
| 113 | return null; | ||
| 114 | @@ -1030,8 +1031,9 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 115 | |||
| 116 | private static void CheckForConditionalMethodError(Expr pExpr) | ||
| 117 | { | ||
| 118 | - if (pExpr is ExprCall call) | ||
| 119 | + if (pExpr is ExprCall) | ||
| 120 | { | ||
| 121 | + ExprCall call = (ExprCall)pExpr; | ||
| 122 | // This mimics the behavior of the native CompilerSymbolLoader in GetConditionalSymbols. Override | ||
| 123 | // methods cannot have the conditional attribute, but implicitly acquire it from their slot. | ||
| 124 | |||
| 125 | @@ -1064,8 +1066,9 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 126 | ExprMemberGroup memgroup; | ||
| 127 | TypeArray typeArgs; | ||
| 128 | |||
| 129 | - if (pResult is ExprCall call) | ||
| 130 | + if (pResult is ExprCall) | ||
| 131 | { | ||
| 132 | + ExprCall call = (ExprCall) pResult; | ||
| 133 | type = call.MethWithInst.Ats; | ||
| 134 | methprop = call.MethWithInst.Meth(); | ||
| 135 | memgroup = call.MemberGroup; | ||
| 136 | @@ -1132,12 +1135,15 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 137 | |||
| 138 | private Expr StripNamedArgument(Expr pArg) | ||
| 139 | { | ||
| 140 | - if (pArg is ExprNamedArgumentSpecification named) | ||
| 141 | + if (pArg is ExprNamedArgumentSpecification) | ||
| 142 | { | ||
| 143 | + ExprNamedArgumentSpecification named = | ||
| 144 | + (ExprNamedArgumentSpecification) pArg; | ||
| 145 | pArg = named.Value; | ||
| 146 | } | ||
| 147 | - else if (pArg is ExprArrayInit init) | ||
| 148 | + else if (pArg is ExprArrayInit) | ||
| 149 | { | ||
| 150 | + ExprArrayInit init = (ExprArrayInit) pArg; | ||
| 151 | init.OptionalArguments = StripNamedArguments(init.OptionalArguments); | ||
| 152 | } | ||
| 153 | |||
| 154 | @@ -1146,14 +1152,16 @@ namespace Microsoft.CSharp.RuntimeBinder | ||
| 155 | |||
| 156 | private Expr StripNamedArguments(Expr pArg) | ||
| 157 | { | ||
| 158 | - if (pArg is ExprList list) | ||
| 159 | + if (pArg is ExprList) | ||
| 160 | { | ||
| 161 | + ExprList list = (ExprList) pArg; | ||
| 162 | for(;;) | ||
| 163 | { | ||
| 164 | list.OptionalElement = StripNamedArgument(list.OptionalElement); | ||
| 165 | |||
| 166 | - if (list.OptionalNextListNode is ExprList next) | ||
| 167 | + if (list.OptionalNextListNode is ExprList) | ||
| 168 | { | ||
| 169 | + ExprList next = (ExprList)list.OptionalNextListNode; | ||
| 170 | list = next; | ||
| 171 | } | ||
| 172 | else | ||
| 173 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/Better.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/Better.cs | ||
| 174 | index cebfcd94e1..179ac21620 100644 | ||
| 175 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/Better.cs | ||
| 176 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/Better.cs | ||
| 177 | @@ -157,8 +157,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 178 | // We then go over the specified arguments and put the type for any named argument in the right position in the array. | ||
| 179 | for (int iParam = 0; iParam < args.carg; iParam++) | ||
| 180 | { | ||
| 181 | - if (prgexpr[iParam] is ExprNamedArgumentSpecification named) | ||
| 182 | + if (prgexpr[iParam] is ExprNamedArgumentSpecification) | ||
| 183 | { | ||
| 184 | + ExprNamedArgumentSpecification named = (ExprNamedArgumentSpecification)prgexpr[iParam]; | ||
| 185 | // We find the index of the type of the argument in the method parameter list and store that in a temp | ||
| 186 | int index = FindName(methProp.ParameterNames, named.Name); | ||
| 187 | CType tempType = pta[index]; | ||
| 188 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/ErrorReporting.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/ErrorReporting.cs | ||
| 189 | index c406af43de..0ea81ef21c 100644 | ||
| 190 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/ErrorReporting.cs | ||
| 191 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/ErrorReporting.cs | ||
| 192 | @@ -76,22 +76,25 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 193 | { | ||
| 194 | Debug.Assert(expr != null); | ||
| 195 | |||
| 196 | - if (expr is ExprLocal local && local.IsOK) | ||
| 197 | + if (expr is ExprLocal && ((ExprLocal)expr).IsOK) | ||
| 198 | { | ||
| 199 | + ExprLocal local = (ExprLocal)expr; | ||
| 200 | ReportLocalError(local.Local, kind, isNested); | ||
| 201 | return true; | ||
| 202 | } | ||
| 203 | |||
| 204 | Expr pObject = null; | ||
| 205 | |||
| 206 | - if (expr is ExprProperty prop) | ||
| 207 | + if (expr is ExprProperty) | ||
| 208 | { | ||
| 209 | + ExprProperty prop = (ExprProperty)expr; | ||
| 210 | // We've already reported read-only-property errors. | ||
| 211 | Debug.Assert(prop.MethWithTypeSet != null); | ||
| 212 | pObject = prop.MemberGroup.OptionalObject; | ||
| 213 | } | ||
| 214 | - else if (expr is ExprField field) | ||
| 215 | + else if (expr is ExprField) | ||
| 216 | { | ||
| 217 | + ExprField field = (ExprField)expr; | ||
| 218 | if (field.FieldWithType.Field().isReadOnly) | ||
| 219 | { | ||
| 220 | ReportReadOnlyError(field, kind, isNested); | ||
| 221 | @@ -105,8 +108,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 222 | |||
| 223 | if (pObject != null && pObject.Type.isStructOrEnum()) | ||
| 224 | { | ||
| 225 | - if (pObject is IExprWithArgs withArgs) | ||
| 226 | + if (pObject is IExprWithArgs) | ||
| 227 | { | ||
| 228 | + IExprWithArgs withArgs = (IExprWithArgs)pObject; | ||
| 229 | // assigning to RHS of method or property getter returning a value-type on the stack or | ||
| 230 | // passing RHS of method or property getter returning a value-type on the stack, as ref or out | ||
| 231 | ErrorContext.Error(ErrorCode.ERR_ReturnNotLValue, withArgs.GetSymWithType()); | ||
| 232 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversion.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversion.cs | ||
| 233 | index 2756538770..99adf488b3 100644 | ||
| 234 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversion.cs | ||
| 235 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversion.cs | ||
| 236 | @@ -382,9 +382,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 237 | FUNDTYPE ftSrc = expr.Type.fundType(); | ||
| 238 | FUNDTYPE ftDest = dest.fundType(); | ||
| 239 | |||
| 240 | - if (expr is ExprConstant constant && constant.IsOK && | ||
| 241 | + if (expr is ExprConstant && ((ExprConstant)expr).IsOK && | ||
| 242 | expr.Type.isSimpleType() && dest.isSimpleType()) | ||
| 243 | { | ||
| 244 | + ExprConstant constant = (ExprConstant) expr; | ||
| 245 | if ((ftSrc == FUNDTYPE.FT_I4 && (ftDest <= FUNDTYPE.FT_LASTNONLONG || ftDest == FUNDTYPE.FT_U8)) || | ||
| 246 | (ftSrc == FUNDTYPE.FT_I8 && ftDest == FUNDTYPE.FT_U8)) | ||
| 247 | { | ||
| 248 | @@ -412,8 +413,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 249 | ErrorContext.Error(dest is TypeParameterType ? ErrorCode.ERR_TypeVarCantBeNull : ErrorCode.ERR_ValueCantBeNull, dest); | ||
| 250 | } | ||
| 251 | |||
| 252 | - else if (expr is ExprMemberGroup memGrp) | ||
| 253 | + else if (expr is ExprMemberGroup) | ||
| 254 | { | ||
| 255 | + ExprMemberGroup memGrp = (ExprMemberGroup) expr; | ||
| 256 | BindGrpConversion(memGrp, dest, true); | ||
| 257 | } | ||
| 258 | else if (canCast(expr.Type, dest, flags)) | ||
| 259 | @@ -546,8 +548,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 260 | { | ||
| 261 | ErrorContext.Error(ErrorCode.ERR_ValueCantBeNull, dest); | ||
| 262 | } | ||
| 263 | - else if (expr is ExprMemberGroup memGrp) | ||
| 264 | + else if (expr is ExprMemberGroup) | ||
| 265 | { | ||
| 266 | + ExprMemberGroup memGrp = (ExprMemberGroup)expr; | ||
| 267 | BindGrpConversion(memGrp, dest, true); | ||
| 268 | } | ||
| 269 | else | ||
| 270 | @@ -1387,8 +1390,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 271 | for (;;) | ||
| 272 | { | ||
| 273 | Debug.Assert(pExpr != null); | ||
| 274 | - if (pExpr is ExprCall call) | ||
| 275 | + if (pExpr is ExprCall) | ||
| 276 | { | ||
| 277 | + ExprCall call = (ExprCall)pExpr; | ||
| 278 | switch (call.NullableCallLiftKind) | ||
| 279 | { | ||
| 280 | case NullableCallLiftKind.NotLifted: | ||
| 281 | @@ -1402,8 +1406,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 282 | continue; | ||
| 283 | } | ||
| 284 | } | ||
| 285 | - else if (pExpr is ExprUserDefinedConversion udc) | ||
| 286 | + else if (pExpr is ExprUserDefinedConversion) | ||
| 287 | { | ||
| 288 | + ExprUserDefinedConversion udc = (ExprUserDefinedConversion)pExpr; | ||
| 289 | pExpr = udc.UserDefinedCall; | ||
| 290 | continue; | ||
| 291 | } | ||
| 292 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRExtensions.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRExtensions.cs | ||
| 293 | index 075ed23a11..6408df4c36 100644 | ||
| 294 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRExtensions.cs | ||
| 295 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRExtensions.cs | ||
| 296 | @@ -33,8 +33,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 297 | Expr exprCur = expr; | ||
| 298 | while (exprCur != null) | ||
| 299 | { | ||
| 300 | - if (exprCur is ExprList list) | ||
| 301 | + if (exprCur is ExprList) | ||
| 302 | { | ||
| 303 | + ExprList list = (ExprList)exprCur; | ||
| 304 | yield return list.OptionalElement; | ||
| 305 | exprCur = list.OptionalNextListNode; | ||
| 306 | } | ||
| 307 | @@ -61,12 +62,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 308 | } | ||
| 309 | public static bool isNull(this Expr expr) | ||
| 310 | { | ||
| 311 | - return expr is ExprConstant constant && constant.IsOK && (expr.Type.fundType() == FUNDTYPE.FT_REF) && constant.Val.IsNullRef; | ||
| 312 | + return expr is ExprConstant && ((ExprConstant)expr).IsOK && (expr.Type.fundType() == FUNDTYPE.FT_REF) && ((ExprConstant)expr).Val.IsNullRef; | ||
| 313 | } | ||
| 314 | |||
| 315 | public static bool IsZero(this Expr expr) | ||
| 316 | { | ||
| 317 | - return expr is ExprConstant constant && constant.IsOK && constant.IsZero; | ||
| 318 | + return expr is ExprConstant && ((ExprConstant)expr).IsOK && ((ExprConstant)expr).IsZero; | ||
| 319 | } | ||
| 320 | |||
| 321 | private static Expr GetSeqVal(this Expr expr) | ||
| 322 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExplicitConversion.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExplicitConversion.cs | ||
| 323 | index b55cf07078..9afeaac622 100644 | ||
| 324 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExplicitConversion.cs | ||
| 325 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExplicitConversion.cs | ||
| 326 | @@ -207,8 +207,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 327 | VSFAIL("BindExplicitConversion failed unexpectedly"); | ||
| 328 | return false; | ||
| 329 | } | ||
| 330 | - if (_exprDest is ExprUserDefinedConversion udc) | ||
| 331 | + if (_exprDest is ExprUserDefinedConversion) | ||
| 332 | { | ||
| 333 | + ExprUserDefinedConversion udc = (ExprUserDefinedConversion)_exprDest; | ||
| 334 | udc.Argument = _exprSrc; | ||
| 335 | } | ||
| 336 | } | ||
| 337 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs | ||
| 338 | index 159f157f43..4a0e3cb479 100644 | ||
| 339 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs | ||
| 340 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs | ||
| 341 | @@ -17,33 +17,33 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 342 | Debug.Assert(globalSymbolContext != null); | ||
| 343 | _globalSymbolContext = globalSymbolContext; | ||
| 344 | } | ||
| 345 | - private TypeManager Types => _globalSymbolContext.GetTypes(); | ||
| 346 | + private TypeManager Types { get { return _globalSymbolContext.GetTypes(); } } | ||
| 347 | |||
| 348 | - private BSYMMGR GlobalSymbols => _globalSymbolContext.GetGlobalSymbols(); | ||
| 349 | + private BSYMMGR GlobalSymbols { get { return _globalSymbolContext.GetGlobalSymbols(); } } | ||
| 350 | |||
| 351 | - public ExprCall CreateCall(EXPRFLAG flags, CType type, Expr arguments, ExprMemberGroup memberGroup, MethWithInst method) => | ||
| 352 | - new ExprCall(type, flags, arguments, memberGroup, method); | ||
| 353 | + public ExprCall CreateCall(EXPRFLAG flags, CType type, Expr arguments, ExprMemberGroup memberGroup, MethWithInst method) | ||
| 354 | + { return new ExprCall(type, flags, arguments, memberGroup, method); } | ||
| 355 | |||
| 356 | - public ExprField CreateField(CType type, Expr optionalObject, FieldWithType field, bool isLValue) => | ||
| 357 | - new ExprField(type, optionalObject, field, isLValue); | ||
| 358 | + public ExprField CreateField(CType type, Expr optionalObject, FieldWithType field, bool isLValue) | ||
| 359 | + { return new ExprField(type, optionalObject, field, isLValue); } | ||
| 360 | |||
| 361 | - public ExprFuncPtr CreateFunctionPointer(EXPRFLAG flags, CType type, Expr obj, MethWithInst method) => | ||
| 362 | - new ExprFuncPtr(type, flags, obj, method); | ||
| 363 | + public ExprFuncPtr CreateFunctionPointer(EXPRFLAG flags, CType type, Expr obj, MethWithInst method) | ||
| 364 | + { return new ExprFuncPtr(type, flags, obj, method); } | ||
| 365 | |||
| 366 | - public ExprArrayInit CreateArrayInit(CType type, Expr arguments, Expr argumentDimensions, int[] dimSizes, int dimSize) => | ||
| 367 | - new ExprArrayInit(type, arguments, argumentDimensions, dimSizes, dimSize); | ||
| 368 | + public ExprArrayInit CreateArrayInit(CType type, Expr arguments, Expr argumentDimensions, int[] dimSizes, int dimSize) | ||
| 369 | + { return new ExprArrayInit(type, arguments, argumentDimensions, dimSizes, dimSize); } | ||
| 370 | |||
| 371 | - public ExprProperty CreateProperty(CType type, Expr optionalObject) => | ||
| 372 | - CreateProperty(type, null, null, CreateMemGroup(optionalObject, new MethPropWithInst()), null, null); | ||
| 373 | + public ExprProperty CreateProperty(CType type, Expr optionalObject) | ||
| 374 | + { return CreateProperty(type, null, null, CreateMemGroup(optionalObject, new MethPropWithInst()), null, null); } | ||
| 375 | |||
| 376 | - public ExprProperty CreateProperty(CType type, Expr optionalObjectThrough, Expr arguments, ExprMemberGroup memberGroup, PropWithType property, MethWithType setMethod) => | ||
| 377 | - new ExprProperty(type, optionalObjectThrough, arguments, memberGroup, property, setMethod); | ||
| 378 | + public ExprProperty CreateProperty(CType type, Expr optionalObjectThrough, Expr arguments, ExprMemberGroup memberGroup, PropWithType property, MethWithType setMethod) | ||
| 379 | + { return new ExprProperty(type, optionalObjectThrough, arguments, memberGroup, property, setMethod); } | ||
| 380 | |||
| 381 | - public ExprEvent CreateEvent(CType type, Expr optionalObject, EventWithType eventWithType) => | ||
| 382 | - new ExprEvent(type, optionalObject, eventWithType); | ||
| 383 | + public ExprEvent CreateEvent(CType type, Expr optionalObject, EventWithType eventWithType) | ||
| 384 | + { return new ExprEvent(type, optionalObject, eventWithType); } | ||
| 385 | |||
| 386 | - public ExprMemberGroup CreateMemGroup(EXPRFLAG flags, Name name, TypeArray typeArgs, SYMKIND symKind, CType parentType, MethodOrPropertySymbol memberSymbol, Expr obj, CMemberLookupResults memberLookupResults) => | ||
| 387 | - new ExprMemberGroup(Types.GetMethGrpType(), flags, name, typeArgs, symKind, parentType, memberSymbol, obj, memberLookupResults); | ||
| 388 | + public ExprMemberGroup CreateMemGroup(EXPRFLAG flags, Name name, TypeArray typeArgs, SYMKIND symKind, CType parentType, MethodOrPropertySymbol memberSymbol, Expr obj, CMemberLookupResults memberLookupResults) | ||
| 389 | + { return new ExprMemberGroup(Types.GetMethGrpType(), flags, name, typeArgs, symKind, parentType, memberSymbol, obj, memberLookupResults); } | ||
| 390 | |||
| 391 | public ExprMemberGroup CreateMemGroup(Expr obj, MethPropWithInst method) | ||
| 392 | { | ||
| 393 | @@ -57,25 +57,25 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 394 | obj, new CMemberLookupResults(GlobalSymbols.AllocParams(1, new[] {type}), name)); | ||
| 395 | } | ||
| 396 | |||
| 397 | - public ExprUserDefinedConversion CreateUserDefinedConversion(Expr arg, Expr call, MethWithInst method) => | ||
| 398 | - new ExprUserDefinedConversion(arg, call, method); | ||
| 399 | + public ExprUserDefinedConversion CreateUserDefinedConversion(Expr arg, Expr call, MethWithInst method) | ||
| 400 | + { return new ExprUserDefinedConversion(arg, call, method); } | ||
| 401 | |||
| 402 | public ExprCast CreateCast(CType type, Expr argument) => CreateCast(0, CreateClass(type), argument); | ||
| 403 | |||
| 404 | - public ExprCast CreateCast(EXPRFLAG flags, ExprClass type, Expr argument) => new ExprCast(flags, type, argument); | ||
| 405 | + public ExprCast CreateCast(EXPRFLAG flags, ExprClass type, Expr argument) { return new ExprCast(flags, type, argument); } | ||
| 406 | |||
| 407 | - public ExprReturn CreateReturn(Expr optionalObject) => new ExprReturn(optionalObject); | ||
| 408 | + public ExprReturn CreateReturn(Expr optionalObject) { return new ExprReturn(optionalObject); } | ||
| 409 | |||
| 410 | - public ExprLocal CreateLocal(LocalVariableSymbol local) => new ExprLocal(local); | ||
| 411 | + public ExprLocal CreateLocal(LocalVariableSymbol local) { return new ExprLocal(local); } | ||
| 412 | |||
| 413 | - public ExprBoundLambda CreateAnonymousMethod(AggregateType delegateType, Scope argumentScope) => | ||
| 414 | - new ExprBoundLambda(delegateType, argumentScope); | ||
| 415 | + public ExprBoundLambda CreateAnonymousMethod(AggregateType delegateType, Scope argumentScope) | ||
| 416 | + { return new ExprBoundLambda(delegateType, argumentScope); } | ||
| 417 | |||
| 418 | - public ExprHoistedLocalExpr CreateHoistedLocalInExpression() => | ||
| 419 | - new ExprHoistedLocalExpr(Types.GetOptPredefAgg(PredefinedType.PT_EXPRESSION).getThisType()); | ||
| 420 | + public ExprHoistedLocalExpr CreateHoistedLocalInExpression() | ||
| 421 | + { return new ExprHoistedLocalExpr(Types.GetOptPredefAgg(PredefinedType.PT_EXPRESSION).getThisType()); } | ||
| 422 | |||
| 423 | - public ExprMethodInfo CreateMethodInfo(MethPropWithInst mwi) => | ||
| 424 | - CreateMethodInfo(mwi.Meth(), mwi.GetType(), mwi.TypeArgs); | ||
| 425 | + public ExprMethodInfo CreateMethodInfo(MethPropWithInst mwi) | ||
| 426 | + { return CreateMethodInfo(mwi.Meth(), mwi.GetType(), mwi.TypeArgs); } | ||
| 427 | |||
| 428 | public ExprMethodInfo CreateMethodInfo(MethodSymbol method, AggregateType methodType, TypeArray methodParameters) | ||
| 429 | { | ||
| 430 | @@ -84,19 +84,19 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 431 | method, methodType, methodParameters); | ||
| 432 | } | ||
| 433 | |||
| 434 | - public ExprPropertyInfo CreatePropertyInfo(PropertySymbol prop, AggregateType propertyType) => | ||
| 435 | - new ExprPropertyInfo(Types.GetOptPredefAgg(PredefinedType.PT_PROPERTYINFO).getThisType(), prop, propertyType); | ||
| 436 | + public ExprPropertyInfo CreatePropertyInfo(PropertySymbol prop, AggregateType propertyType) | ||
| 437 | + { return new ExprPropertyInfo(Types.GetOptPredefAgg(PredefinedType.PT_PROPERTYINFO).getThisType(), prop, propertyType); } | ||
| 438 | |||
| 439 | - public ExprFieldInfo CreateFieldInfo(FieldSymbol field, AggregateType fieldType) => | ||
| 440 | - new ExprFieldInfo(field, fieldType, Types.GetOptPredefAgg(PredefinedType.PT_FIELDINFO).getThisType()); | ||
| 441 | + public ExprFieldInfo CreateFieldInfo(FieldSymbol field, AggregateType fieldType) | ||
| 442 | + { return new ExprFieldInfo(field, fieldType, Types.GetOptPredefAgg(PredefinedType.PT_FIELDINFO).getThisType()); } | ||
| 443 | |||
| 444 | - private ExprTypeOf CreateTypeOf(ExprClass sourceType) => | ||
| 445 | - new ExprTypeOf(Types.GetReqPredefAgg(PredefinedType.PT_TYPE).getThisType(), sourceType); | ||
| 446 | + private ExprTypeOf CreateTypeOf(ExprClass sourceType) | ||
| 447 | + { return new ExprTypeOf(Types.GetReqPredefAgg(PredefinedType.PT_TYPE).getThisType(), sourceType); } | ||
| 448 | |||
| 449 | - public ExprTypeOf CreateTypeOf(CType sourceType) => CreateTypeOf(CreateClass(sourceType)); | ||
| 450 | + public ExprTypeOf CreateTypeOf(CType sourceType) { return CreateTypeOf(CreateClass(sourceType)); } | ||
| 451 | |||
| 452 | - public ExprUserLogicalOp CreateUserLogOp(CType type, Expr trueFalseCall, ExprCall operatorCall) => | ||
| 453 | - new ExprUserLogicalOp(type, trueFalseCall, operatorCall); | ||
| 454 | + public ExprUserLogicalOp CreateUserLogOp(CType type, Expr trueFalseCall, ExprCall operatorCall) | ||
| 455 | + { return new ExprUserLogicalOp(type, trueFalseCall, operatorCall); } | ||
| 456 | |||
| 457 | public ExprUserLogicalOp CreateUserLogOpError(CType type, Expr trueFalseCall, ExprCall operatorCall) | ||
| 458 | { | ||
| 459 | @@ -105,16 +105,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 460 | return rval; | ||
| 461 | } | ||
| 462 | |||
| 463 | - public ExprConcat CreateConcat(Expr first, Expr second) => new ExprConcat(first, second); | ||
| 464 | + public ExprConcat CreateConcat(Expr first, Expr second) { return new ExprConcat(first, second); } | ||
| 465 | |||
| 466 | - public ExprConstant CreateStringConstant(string str) => | ||
| 467 | - CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_STRING).getThisType(), ConstVal.Get(str)); | ||
| 468 | + public ExprConstant CreateStringConstant(string str) | ||
| 469 | + { return CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_STRING).getThisType(), ConstVal.Get(str)); } | ||
| 470 | |||
| 471 | - public ExprMultiGet CreateMultiGet(EXPRFLAG flags, CType type, ExprMulti multi) => | ||
| 472 | - new ExprMultiGet(type, flags, multi); | ||
| 473 | + public ExprMultiGet CreateMultiGet(EXPRFLAG flags, CType type, ExprMulti multi) | ||
| 474 | + { return new ExprMultiGet(type, flags, multi); } | ||
| 475 | |||
| 476 | - public ExprMulti CreateMulti(EXPRFLAG flags, CType type, Expr left, Expr op) => | ||
| 477 | - new ExprMulti(type, flags, left, op); | ||
| 478 | + public ExprMulti CreateMulti(EXPRFLAG flags, CType type, Expr left, Expr op) | ||
| 479 | + { return new ExprMulti(type, flags, left, op); } | ||
| 480 | |||
| 481 | //////////////////////////////////////////////////////////////////////////////// | ||
| 482 | // | ||
| 483 | @@ -124,7 +124,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 484 | // | ||
| 485 | // This returns a null for reference types and an EXPRZEROINIT for all others. | ||
| 486 | |||
| 487 | - public Expr CreateZeroInit(CType type) => CreateZeroInit(CreateClass(type), null, false); | ||
| 488 | + public Expr CreateZeroInit(CType type) { return CreateZeroInit(CreateClass(type), null, false); } | ||
| 489 | |||
| 490 | private Expr CreateZeroInit(ExprClass typeExpr, Expr originalConstructorCall, bool isConstructor) | ||
| 491 | { | ||
| 492 | @@ -187,15 +187,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 493 | return new ExprZeroInit(type, originalConstructorCall, isConstructor, isError); | ||
| 494 | } | ||
| 495 | |||
| 496 | - public ExprConstant CreateConstant(CType type, ConstVal constVal) => new ExprConstant(type, constVal); | ||
| 497 | + public ExprConstant CreateConstant(CType type, ConstVal constVal) { return new ExprConstant(type, constVal); } | ||
| 498 | |||
| 499 | - public ExprConstant CreateIntegerConstant(int x) => | ||
| 500 | - CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_INT).getThisType(), ConstVal.Get(x)); | ||
| 501 | + public ExprConstant CreateIntegerConstant(int x) | ||
| 502 | + { return CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_INT).getThisType(), ConstVal.Get(x)); } | ||
| 503 | |||
| 504 | - public ExprConstant CreateBoolConstant(bool b) => | ||
| 505 | - CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_BOOL).getThisType(), ConstVal.Get(b)); | ||
| 506 | + public ExprConstant CreateBoolConstant(bool b) | ||
| 507 | + { return CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_BOOL).getThisType(), ConstVal.Get(b)); } | ||
| 508 | |||
| 509 | - public ExprBlock CreateBlock(ExprStatement pOptionalStatements) => new ExprBlock(pOptionalStatements); | ||
| 510 | + public ExprBlock CreateBlock(ExprStatement pOptionalStatements) { return new ExprBlock(pOptionalStatements); } | ||
| 511 | |||
| 512 | public ExprArrayIndex CreateArrayIndex(Expr array, Expr index) | ||
| 513 | { | ||
| 514 | @@ -212,11 +212,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 515 | return new ExprArrayIndex(type, array, index); | ||
| 516 | } | ||
| 517 | |||
| 518 | - public ExprBinOp CreateBinop(ExpressionKind exprKind, CType type, Expr left, Expr right) => | ||
| 519 | - new ExprBinOp(exprKind, type, left, right); | ||
| 520 | + public ExprBinOp CreateBinop(ExpressionKind exprKind, CType type, Expr left, Expr right) | ||
| 521 | + { return new ExprBinOp(exprKind, type, left, right); } | ||
| 522 | |||
| 523 | - public ExprUnaryOp CreateUnaryOp(ExpressionKind exprKind, CType type, Expr operand) => | ||
| 524 | - new ExprUnaryOp(exprKind, type, operand); | ||
| 525 | + public ExprUnaryOp CreateUnaryOp(ExpressionKind exprKind, CType type, Expr operand) | ||
| 526 | + { return new ExprUnaryOp(exprKind, type, operand); } | ||
| 527 | |||
| 528 | public ExprOperator CreateOperator(ExpressionKind exprKind, CType type, Expr arg1, Expr arg2) | ||
| 529 | { | ||
| 530 | @@ -228,12 +228,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 531 | } | ||
| 532 | |||
| 533 | |||
| 534 | - public ExprBinOp CreateUserDefinedBinop(ExpressionKind exprKind, CType type, Expr left, Expr right, Expr call, MethPropWithInst userMethod) => | ||
| 535 | - new ExprBinOp(exprKind, type, left, right, call, userMethod); | ||
| 536 | + public ExprBinOp CreateUserDefinedBinop(ExpressionKind exprKind, CType type, Expr left, Expr right, Expr call, MethPropWithInst userMethod) | ||
| 537 | + { return new ExprBinOp(exprKind, type, left, right, call, userMethod); } | ||
| 538 | |||
| 539 | // The call may be lifted, but we do not mark the outer binop as lifted. | ||
| 540 | - public ExprUnaryOp CreateUserDefinedUnaryOperator(ExpressionKind exprKind, CType type, Expr operand, ExprCall call, MethPropWithInst userMethod) => | ||
| 541 | - new ExprUnaryOp(exprKind, type, operand, call, userMethod); | ||
| 542 | + public ExprUnaryOp CreateUserDefinedUnaryOperator(ExpressionKind exprKind, CType type, Expr operand, ExprCall call, MethPropWithInst userMethod) | ||
| 543 | + { return new ExprUnaryOp(exprKind, type, operand, call, userMethod); } | ||
| 544 | |||
| 545 | public ExprUnaryOp CreateNeg(EXPRFLAG flags, Expr operand) | ||
| 546 | { | ||
| 547 | @@ -246,23 +246,22 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 548 | //////////////////////////////////////////////////////////////////////////////// | ||
| 549 | // Create a node that evaluates the first, evaluates the second, results in the second. | ||
| 550 | |||
| 551 | - public ExprBinOp CreateSequence(Expr first, Expr second) => | ||
| 552 | - CreateBinop(ExpressionKind.Sequence, second.Type, first, second); | ||
| 553 | + public ExprBinOp CreateSequence(Expr first, Expr second) | ||
| 554 | + { return CreateBinop(ExpressionKind.Sequence, second.Type, first, second); } | ||
| 555 | |||
| 556 | //////////////////////////////////////////////////////////////////////////////// | ||
| 557 | // Create a node that evaluates the first, evaluates the second, results in the first. | ||
| 558 | |||
| 559 | - public ExprBinOp CreateReverseSequence(Expr first, Expr second) => | ||
| 560 | - CreateBinop(ExpressionKind.SequenceReverse, first.Type, first, second); | ||
| 561 | + public ExprBinOp CreateReverseSequence(Expr first, Expr second) | ||
| 562 | + { return CreateBinop(ExpressionKind.SequenceReverse, first.Type, first, second); } | ||
| 563 | |||
| 564 | - public ExprAssignment CreateAssignment(Expr left, Expr right) => new ExprAssignment(left, right); | ||
| 565 | + public ExprAssignment CreateAssignment(Expr left, Expr right) { return new ExprAssignment(left, right); } | ||
| 566 | |||
| 567 | //////////////////////////////////////////////////////////////////////////////// | ||
| 568 | |||
| 569 | - public ExprNamedArgumentSpecification CreateNamedArgumentSpecification(Name name, Expr value) => | ||
| 570 | - new ExprNamedArgumentSpecification(name, value); | ||
| 571 | + public ExprNamedArgumentSpecification CreateNamedArgumentSpecification(Name name, Expr value) { return new ExprNamedArgumentSpecification(name, value); } | ||
| 572 | |||
| 573 | - public ExprWrap CreateWrap(Expr expression) => new ExprWrap(expression); | ||
| 574 | + public ExprWrap CreateWrap(Expr expression) { return new ExprWrap(expression); } | ||
| 575 | |||
| 576 | public ExprBinOp CreateSave(ExprWrap wrap) | ||
| 577 | { | ||
| 578 | @@ -272,7 +271,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 579 | return expr; | ||
| 580 | } | ||
| 581 | |||
| 582 | - public ExprConstant CreateNull() => CreateConstant(Types.GetNullType(), default(ConstVal)); | ||
| 583 | + public ExprConstant CreateNull() { return CreateConstant(Types.GetNullType(), default(ConstVal)); } | ||
| 584 | |||
| 585 | public void AppendItemToList( | ||
| 586 | Expr newItem, | ||
| 587 | @@ -306,14 +305,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 588 | last = list.OptionalNextListNode; | ||
| 589 | } | ||
| 590 | |||
| 591 | - public ExprList CreateList(Expr op1, Expr op2) => new ExprList(op1, op2); | ||
| 592 | + public ExprList CreateList(Expr op1, Expr op2) { return new ExprList(op1, op2); } | ||
| 593 | |||
| 594 | - public ExprList CreateList(Expr op1, Expr op2, Expr op3) => CreateList(op1, CreateList(op2, op3)); | ||
| 595 | + public ExprList CreateList(Expr op1, Expr op2, Expr op3) { return CreateList(op1, CreateList(op2, op3)); } | ||
| 596 | |||
| 597 | - public ExprList CreateList(Expr op1, Expr op2, Expr op3, Expr op4) => | ||
| 598 | - CreateList(op1, CreateList(op2, CreateList(op3, op4))); | ||
| 599 | + public ExprList CreateList(Expr op1, Expr op2, Expr op3, Expr op4) { return CreateList(op1, CreateList(op2, CreateList(op3, op4))); } | ||
| 600 | |||
| 601 | - public ExprClass CreateClass(CType type) => new ExprClass(type); | ||
| 602 | + public ExprClass CreateClass(CType type) { return new ExprClass(type); } | ||
| 603 | } | ||
| 604 | } | ||
| 605 | |||
| 606 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs | ||
| 607 | index ee75e7b38e..bd7c52f87e 100644 | ||
| 608 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs | ||
| 609 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs | ||
| 610 | @@ -601,10 +601,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 611 | // Check if we have a compile time constant. If we do, create a constant for it and set the | ||
| 612 | // original tree to the cast. | ||
| 613 | |||
| 614 | - if (exprConst is ExprConstant constant && exprFlags == 0 && | ||
| 615 | + if (exprConst is ExprConstant && exprFlags == 0 && | ||
| 616 | exprSrc.Type.fundType() == typeDest.fundType() && | ||
| 617 | - (!exprSrc.Type.isPredefType(PredefinedType.PT_STRING) || constant.Val.IsNullRef)) | ||
| 618 | + (!exprSrc.Type.isPredefType(PredefinedType.PT_STRING) || ((ExprConstant)exprConst).Val.IsNullRef)) | ||
| 619 | { | ||
| 620 | + ExprConstant constant = (ExprConstant)exprConst; | ||
| 621 | ExprConstant expr = GetExprFactory().CreateConstant(typeDest, constant.Val); | ||
| 622 | pexprDest = expr; | ||
| 623 | return; | ||
| 624 | @@ -1191,8 +1192,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 625 | while (list != null) | ||
| 626 | { | ||
| 627 | Expr arg; | ||
| 628 | - if (list is ExprList next) | ||
| 629 | + if (list is ExprList) | ||
| 630 | { | ||
| 631 | + ExprList next = (ExprList)list; | ||
| 632 | arg = next.OptionalElement; | ||
| 633 | list = next.OptionalNextListNode; | ||
| 634 | } | ||
| 635 | @@ -1265,8 +1267,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 636 | |||
| 637 | private Expr UnwrapExpression(Expr pExpression) | ||
| 638 | { | ||
| 639 | - while (pExpression is ExprWrap wrap) | ||
| 640 | + while (pExpression is ExprWrap) | ||
| 641 | { | ||
| 642 | + ExprWrap wrap = (ExprWrap)pExpression; | ||
| 643 | Expr wrapped = wrap.OptionalExpression; | ||
| 644 | if (wrapped == null) | ||
| 645 | { | ||
| 646 | @@ -1344,8 +1347,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 647 | return false; | ||
| 648 | if (expr.isLvalue()) | ||
| 649 | { | ||
| 650 | - if (expr is ExprProperty prop) | ||
| 651 | + if (expr is ExprProperty) | ||
| 652 | { | ||
| 653 | + ExprProperty prop = (ExprProperty)expr; | ||
| 654 | CheckLvalueProp(prop); | ||
| 655 | } | ||
| 656 | markFieldAssigned(expr); | ||
| 657 | @@ -1570,9 +1574,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 658 | |||
| 659 | // If we're invoking code on a struct-valued field, mark the struct as assigned (to | ||
| 660 | // avoid warning CS0649). | ||
| 661 | - if (pObject is ExprField field && !field.FieldWithType.Field().isAssigned && !swt.Sym.IsFieldSymbol() && | ||
| 662 | + if (pObject is ExprField && !((ExprField)pObject).FieldWithType.Field().isAssigned && !swt.Sym.IsFieldSymbol() && | ||
| 663 | typeObj.isStructType() && !typeObj.isPredefined()) | ||
| 664 | { | ||
| 665 | + ExprField field = (ExprField) pObject; | ||
| 666 | field.FieldWithType.Field().isAssigned = true; | ||
| 667 | } | ||
| 668 | |||
| 669 | @@ -1779,8 +1784,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 670 | |||
| 671 | Expr argument = indir; | ||
| 672 | Expr rval; | ||
| 673 | - if (argument is ExprNamedArgumentSpecification named) | ||
| 674 | + if (argument is ExprNamedArgumentSpecification) | ||
| 675 | { | ||
| 676 | + ExprNamedArgumentSpecification named = (ExprNamedArgumentSpecification)argument; | ||
| 677 | int index = 0; | ||
| 678 | // If we're named, look for the type of the matching name. | ||
| 679 | foreach (Name i in mostDerivedMethod.ParameterNames) | ||
| 680 | @@ -1918,8 +1924,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 681 | Expr expr = it.Current(); | ||
| 682 | count++; | ||
| 683 | |||
| 684 | - if (expr is ExprNamedArgumentSpecification named) | ||
| 685 | + if (expr is ExprNamedArgumentSpecification) | ||
| 686 | { | ||
| 687 | + ExprNamedArgumentSpecification named = (ExprNamedArgumentSpecification)expr; | ||
| 688 | named.Value = tryConvert(named.Value, elementType); | ||
| 689 | } | ||
| 690 | else | ||
| 691 | @@ -1941,8 +1948,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 692 | |||
| 693 | private void markFieldAssigned(Expr expr) | ||
| 694 | { | ||
| 695 | - if (0 != (expr.Flags & EXPRFLAG.EXF_LVALUE) && expr is ExprField field) | ||
| 696 | + if (0 != (expr.Flags & EXPRFLAG.EXF_LVALUE) && expr is ExprField) | ||
| 697 | { | ||
| 698 | + ExprField field = (ExprField) expr; | ||
| 699 | FieldSymbol symbol; | ||
| 700 | do | ||
| 701 | { | ||
| 702 | @@ -2009,8 +2017,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 703 | for (Expr list = args; list != null; iarg++) | ||
| 704 | { | ||
| 705 | Expr arg; | ||
| 706 | - if (list is ExprList next) | ||
| 707 | + if (list is ExprList) | ||
| 708 | { | ||
| 709 | + ExprList next = (ExprList)list; | ||
| 710 | arg = next.OptionalElement; | ||
| 711 | list = next.OptionalNextListNode; | ||
| 712 | } | ||
| 713 | @@ -2364,8 +2373,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 714 | { | ||
| 715 | Expr arg; | ||
| 716 | |||
| 717 | - if (list is ExprList next) | ||
| 718 | + if (list is ExprList) | ||
| 719 | { | ||
| 720 | + ExprList next = (ExprList)list; | ||
| 721 | arg = next.OptionalElement; | ||
| 722 | list = next.OptionalNextListNode; | ||
| 723 | } | ||
| 724 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinder.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinder.cs | ||
| 725 | index 25a8d40341..d17de3977d 100644 | ||
| 726 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinder.cs | ||
| 727 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinder.cs | ||
| 728 | @@ -510,7 +510,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 729 | // then let us through. | ||
| 730 | if (methprop.isParamArray && | ||
| 731 | index < pArguments.carg && | ||
| 732 | - pArguments.prgexpr[index] is ExprArrayInit arrayInit && arrayInit.GeneratedForParamArray) | ||
| 733 | + pArguments.prgexpr[index] is ExprArrayInit && ((ExprArrayInit)pArguments.prgexpr[index]).GeneratedForParamArray) | ||
| 734 | { | ||
| 735 | paramArrayArgument = pArguments.prgexpr[index]; | ||
| 736 | } | ||
| 737 | @@ -518,7 +518,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 738 | // Positional. | ||
| 739 | if (index < pArguments.carg && | ||
| 740 | !(pArguments.prgexpr[index] is ExprNamedArgumentSpecification) && | ||
| 741 | - !(pArguments.prgexpr[index] is ExprArrayInit arrayInitPos && arrayInitPos.GeneratedForParamArray)) | ||
| 742 | + !(pArguments.prgexpr[index] is ExprArrayInit && ((ExprArrayInit)pArguments.prgexpr[index]).GeneratedForParamArray)) | ||
| 743 | { | ||
| 744 | pExprArguments[index] = pArguments.prgexpr[index++]; | ||
| 745 | continue; | ||
| 746 | @@ -839,7 +839,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 747 | for (int i = 0; i < pArguments.carg; i++) | ||
| 748 | { | ||
| 749 | Expr expr = prgexpr[i]; | ||
| 750 | - if (expr is ExprNamedArgumentSpecification named && named.Name == pName) | ||
| 751 | + if (expr is ExprNamedArgumentSpecification && ((ExprNamedArgumentSpecification)expr).Name == pName) | ||
| 752 | { | ||
| 753 | return expr; | ||
| 754 | } | ||
| 755 | @@ -861,7 +861,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 756 | HashSet<Name> names = new HashSet<Name>(); | ||
| 757 | for (int i = 0; i < _pArguments.carg; i++) | ||
| 758 | { | ||
| 759 | - if (!(_pArguments.prgexpr[i] is ExprNamedArgumentSpecification named)) | ||
| 760 | + ExprNamedArgumentSpecification named; | ||
| 761 | + if (!(_pArguments.prgexpr[i] is ExprNamedArgumentSpecification)) | ||
| 762 | { | ||
| 763 | if (!currentPosition.IsEmpty()) | ||
| 764 | { | ||
| 765 | @@ -869,6 +870,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 766 | } | ||
| 767 | continue; | ||
| 768 | } | ||
| 769 | + named = (ExprNamedArgumentSpecification) _pArguments.prgexpr[i]; | ||
| 770 | |||
| 771 | Name name = named.Name; | ||
| 772 | if (!methprop.ParameterNames.Contains(name)) | ||
| 773 | @@ -1080,8 +1082,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 774 | Expr pArgument = _pArguments.prgexpr[ivar]; | ||
| 775 | |||
| 776 | // If we have a named argument, strip it to do the conversion. | ||
| 777 | - if (pArgument is ExprNamedArgumentSpecification named) | ||
| 778 | + if (pArgument is ExprNamedArgumentSpecification) | ||
| 779 | { | ||
| 780 | + ExprNamedArgumentSpecification named = (ExprNamedArgumentSpecification)pArgument; | ||
| 781 | pArgument = named.Value; | ||
| 782 | } | ||
| 783 | |||
| 784 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ImplicitConversion.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ImplicitConversion.cs | ||
| 785 | index c9eb5ae21d..cde533d750 100644 | ||
| 786 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ImplicitConversion.cs | ||
| 787 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ImplicitConversion.cs | ||
| 788 | @@ -172,8 +172,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 789 | VSFAIL("Bad type symbol kind"); | ||
| 790 | break; | ||
| 791 | case TypeKind.TK_MethodGroupType: | ||
| 792 | - if (_exprSrc is ExprMemberGroup memGrp) | ||
| 793 | + if (_exprSrc is ExprMemberGroup) | ||
| 794 | { | ||
| 795 | + ExprMemberGroup memGrp = (ExprMemberGroup)_exprSrc; | ||
| 796 | ExprCall outExpr; | ||
| 797 | bool retVal = _binder.BindGrpConversion(memGrp, _typeDest, _needsExprDest, out outExpr, false); | ||
| 798 | _exprDest = outExpr; | ||
| 799 | @@ -737,10 +738,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 800 | // * A constant-expression of type long can be converted to type ulong, provided the value of | ||
| 801 | // the constant-expression is not negative. | ||
| 802 | // Note: Don't use GetConst here since the conversion only applies to bona-fide compile time constants. | ||
| 803 | - if (_exprSrc is ExprConstant constant && _exprSrc.IsOK && | ||
| 804 | + if (_exprSrc is ExprConstant && _exprSrc.IsOK && | ||
| 805 | ((ptSrc == PredefinedType.PT_INT && ptDest != PredefinedType.PT_BOOL && ptDest != PredefinedType.PT_CHAR) || | ||
| 806 | (ptSrc == PredefinedType.PT_LONG && ptDest == PredefinedType.PT_ULONG)) && | ||
| 807 | - isConstantInRange(constant, _typeDest)) | ||
| 808 | + isConstantInRange(((ExprConstant)_exprSrc), _typeDest)) | ||
| 809 | { | ||
| 810 | // Special case (CLR 6.1.6): if integral constant is in range, the conversion is a legal implicit conversion. | ||
| 811 | convertKind = ConvKind.Implicit; | ||
| 812 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodTypeInferrer.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodTypeInferrer.cs | ||
| 813 | index 52d354ac53..f43684690d 100644 | ||
| 814 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodTypeInferrer.cs | ||
| 815 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodTypeInferrer.cs | ||
| 816 | @@ -1063,10 +1063,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 817 | // SPEC: yields a single method with return CType U then a lower-bound | ||
| 818 | // SPEC: inference is made from U to Tb. | ||
| 819 | |||
| 820 | - if (!(pSource is ExprMemberGroup memGrp)) | ||
| 821 | + if (!(pSource is ExprMemberGroup)) | ||
| 822 | { | ||
| 823 | return false; | ||
| 824 | } | ||
| 825 | + ExprMemberGroup memGrp = (ExprMemberGroup)pSource; | ||
| 826 | pType = pType.GetDelegateTypeOfPossibleExpression(); | ||
| 827 | if (!pType.isDelegateType()) | ||
| 828 | { | ||
| 829 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs | ||
| 830 | index b23fc44509..7dbe8227ca 100644 | ||
| 831 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs | ||
| 832 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs | ||
| 833 | @@ -29,8 +29,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 834 | { | ||
| 835 | Debug.Assert(expr != null); | ||
| 836 | |||
| 837 | - if (expr is ExprCall pCall && pCall.MemberGroup.OptionalObject == null) | ||
| 838 | + if (expr is ExprCall && ((ExprCall)expr).MemberGroup.OptionalObject == null) | ||
| 839 | { | ||
| 840 | + ExprCall pCall = (ExprCall)expr; | ||
| 841 | MethodSymbol meth = pCall.MethWithInst.Meth(); | ||
| 842 | if (meth != null && meth.IsNullableConstructor()) | ||
| 843 | { | ||
| 844 | @@ -45,7 +46,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 845 | |||
| 846 | public static Expr StripNullableConstructor(Expr pExpr) | ||
| 847 | { | ||
| 848 | - while (IsNullableConstructor(pExpr, out ExprCall call)) | ||
| 849 | + ExprCall call; | ||
| 850 | + while (IsNullableConstructor(pExpr, out call)) | ||
| 851 | { | ||
| 852 | pExpr = call.OptionalArguments; | ||
| 853 | Debug.Assert(pExpr != null && !(pExpr is ExprList)); | ||
| 854 | @@ -60,7 +62,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 855 | Debug.Assert(exprSrc != null && exprSrc.Type.IsNullableType()); | ||
| 856 | |||
| 857 | // For new T?(x), the answer is x. | ||
| 858 | - if (IsNullableConstructor(exprSrc, out ExprCall call)) | ||
| 859 | + ExprCall call; | ||
| 860 | + if (IsNullableConstructor(exprSrc, out call)) | ||
| 861 | { | ||
| 862 | var args = call.OptionalArguments; | ||
| 863 | Debug.Assert(args != null && !(args is ExprList)); | ||
| 864 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExpressionIterator.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExpressionIterator.cs | ||
| 865 | index 96ee032422..9397543de6 100644 | ||
| 866 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExpressionIterator.cs | ||
| 867 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExpressionIterator.cs | ||
| 868 | @@ -83,8 +83,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 869 | _pList = null; | ||
| 870 | _pCurrent = null; | ||
| 871 | } | ||
| 872 | - else if (pExpr is ExprList pList) | ||
| 873 | + else if (pExpr is ExprList) | ||
| 874 | { | ||
| 875 | + ExprList pList = (ExprList)pExpr; | ||
| 876 | _pList = pList; | ||
| 877 | _pCurrent = pList.OptionalElement; | ||
| 878 | } | ||
| 879 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExprVisitorBase.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExprVisitorBase.cs | ||
| 880 | index 2abac4cecc..84bc0e1d4c 100644 | ||
| 881 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExprVisitorBase.cs | ||
| 882 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExprVisitorBase.cs | ||
| 883 | @@ -21,8 +21,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 884 | return pResult; | ||
| 885 | } | ||
| 886 | |||
| 887 | - if (pExpr is ExprStatement statement) | ||
| 888 | + if (pExpr is ExprStatement) | ||
| 889 | { | ||
| 890 | + ExprStatement statement = (ExprStatement)pExpr; | ||
| 891 | return CacheExprMapping(pExpr, DispatchStatementList(statement)); | ||
| 892 | } | ||
| 893 | |||
| 894 | @@ -275,11 +276,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 895 | return; | ||
| 896 | } | ||
| 897 | |||
| 898 | - if (!(nextNode is ExprList next)) | ||
| 899 | + ExprList next; | ||
| 900 | + if (!(nextNode is ExprList)) | ||
| 901 | { | ||
| 902 | list.OptionalNextListNode = Visit(nextNode); | ||
| 903 | return; | ||
| 904 | } | ||
| 905 | + next = (ExprList)nextNode; | ||
| 906 | |||
| 907 | list = next; | ||
| 908 | } | ||
| 909 | diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExpressionTreeRewriter.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExpressionTreeRewriter.cs | ||
| 910 | index 96075b6d38..e0581fd14e 100644 | ||
| 911 | --- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExpressionTreeRewriter.cs | ||
| 912 | +++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExpressionTreeRewriter.cs | ||
| 913 | @@ -50,8 +50,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 914 | // For assignments, we either have a member assignment or an indexed assignment. | ||
| 915 | //Debug.Assert(assignment.GetLHS().isPROP() || assignment.GetLHS().isFIELD() || assignment.GetLHS().isARRAYINDEX() || assignment.GetLHS().isLOCAL()); | ||
| 916 | Expr lhs; | ||
| 917 | - if (assignment.LHS is ExprProperty prop) | ||
| 918 | + if (assignment.LHS is ExprProperty) | ||
| 919 | { | ||
| 920 | + ExprProperty prop = (ExprProperty)assignment.LHS; | ||
| 921 | if (prop.OptionalArguments== null) | ||
| 922 | { | ||
| 923 | // Regular property. | ||
| 924 | @@ -304,8 +305,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 925 | // can handle in the general case all implicit boxing conversions. Right now it | ||
| 926 | // requires that all arguments to a call that need to be boxed be explicitly boxed. | ||
| 927 | |||
| 928 | - if (pObject != null && pObject is ExprCast cast && cast.IsBoxingCast) | ||
| 929 | + if (pObject != null && pObject is ExprCast && ((ExprCast)pObject).IsBoxingCast) | ||
| 930 | { | ||
| 931 | + ExprCast cast = (ExprCast) pObject; | ||
| 932 | pObject = cast.Argument; | ||
| 933 | } | ||
| 934 | pObject = Visit(pObject); | ||
| 935 | @@ -576,8 +578,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 936 | if (udcall != null) | ||
| 937 | { | ||
| 938 | Debug.Assert(udcall.Kind == ExpressionKind.Call || udcall.Kind == ExpressionKind.UserLogicalOp); | ||
| 939 | - if (udcall is ExprCall ascall) | ||
| 940 | + if (udcall is ExprCall) | ||
| 941 | { | ||
| 942 | + ExprCall ascall = (ExprCall)udcall; | ||
| 943 | ExprList args = (ExprList)ascall.OptionalArguments; | ||
| 944 | Debug.Assert(args.OptionalNextListNode.Kind != ExpressionKind.List); | ||
| 945 | p1 = args.OptionalElement; | ||
| 946 | @@ -708,8 +711,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 947 | ExprBlock body = anonmeth.OptionalBody; | ||
| 948 | |||
| 949 | // The most likely case: | ||
| 950 | - if (body.OptionalStatements is ExprReturn ret) | ||
| 951 | + if (body.OptionalStatements is ExprReturn) | ||
| 952 | { | ||
| 953 | + ExprReturn ret = (ExprReturn)body.OptionalStatements; | ||
| 954 | Debug.Assert(ret.OptionalObject != null); | ||
| 955 | return Visit(ret.OptionalObject); | ||
| 956 | } | ||
| 957 | @@ -831,8 +835,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 958 | Expr pUDConversion = call?.PConversions; | ||
| 959 | if (pUDConversion != null) | ||
| 960 | { | ||
| 961 | - if (pUDConversion is ExprCall convCall) | ||
| 962 | + if (pUDConversion is ExprCall) | ||
| 963 | { | ||
| 964 | + ExprCall convCall = (ExprCall)pUDConversion; | ||
| 965 | Expr pUDConversionArgument = convCall.OptionalArguments; | ||
| 966 | if (IsNullableValueAccess(pUDConversionArgument, pArgument)) | ||
| 967 | { | ||
| 968 | @@ -1174,23 +1179,25 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics | ||
| 969 | private bool IsNullableValueAccess(Expr pExpr, Expr pObject) | ||
| 970 | { | ||
| 971 | Debug.Assert(pExpr != null); | ||
| 972 | - return pExpr is ExprProperty prop && prop.MemberGroup.OptionalObject == pObject && pObject.Type.IsNullableType(); | ||
| 973 | + return pExpr is ExprProperty && ((ExprProperty)pExpr).MemberGroup.OptionalObject == pObject && pObject.Type.IsNullableType(); | ||
| 974 | } | ||
| 975 | |||
| 976 | private bool IsDelegateConstructorCall(Expr pExpr) | ||
| 977 | { | ||
| 978 | Debug.Assert(pExpr != null); | ||
| 979 | - if (!(pExpr is ExprCall pCall)) | ||
| 980 | + ExprCall pCall; | ||
| 981 | + if (!(pExpr is ExprCall)) | ||
| 982 | { | ||
| 983 | return false; | ||
| 984 | } | ||
| 985 | + pCall = (ExprCall)pExpr; | ||
| 986 | |||
| 987 | return pCall.MethWithInst.Meth() != null && | ||
| 988 | pCall.MethWithInst.Meth().IsConstructor() && | ||
| 989 | pCall.Type.isDelegateType() && | ||
| 990 | pCall.OptionalArguments != null && | ||
| 991 | - pCall.OptionalArguments is ExprList list && | ||
| 992 | - list.OptionalNextListNode.Kind == ExpressionKind.FunctionPointer; | ||
| 993 | + (pCall.OptionalArguments is ExprList) && | ||
| 994 | + ((ExprList)pCall.OptionalArguments).OptionalNextListNode.Kind == ExpressionKind.FunctionPointer; | ||
| 995 | } | ||
| 996 | private static bool isEnumToDecimalConversion(CType argtype, CType desttype) | ||
| 997 | { | ||
| 998 | diff --git a/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs b/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs | ||
| 999 | index 4eb817c0af..671636f428 100644 | ||
| 1000 | --- a/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs | ||
| 1001 | +++ b/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs | ||
| 1002 | @@ -352,7 +352,10 @@ namespace System.Collections.Generic | ||
| 1003 | throw new PlatformNotSupportedException(); | ||
| 1004 | } | ||
| 1005 | |||
| 1006 | - protected override void OnDeserialization(Object sender) => throw new PlatformNotSupportedException(); | ||
| 1007 | + protected override void OnDeserialization(Object sender) | ||
| 1008 | + { | ||
| 1009 | + throw new PlatformNotSupportedException(); | ||
| 1010 | + } | ||
| 1011 | } | ||
| 1012 | } | ||
| 1013 | } | ||
| 1014 | diff --git a/src/System.Drawing.Common/src/System/Drawing/Brush.cs b/src/System.Drawing.Common/src/System/Drawing/Brush.cs | ||
| 1015 | index 089069ed64..b202ef7736 100644 | ||
| 1016 | --- a/src/System.Drawing.Common/src/System/Drawing/Brush.cs | ||
| 1017 | +++ b/src/System.Drawing.Common/src/System/Drawing/Brush.cs | ||
| 1018 | @@ -62,6 +62,6 @@ namespace System.Drawing | ||
| 1019 | } | ||
| 1020 | } | ||
| 1021 | |||
| 1022 | - ~Brush() => Dispose(false); | ||
| 1023 | + ~Brush() { Dispose(false); } | ||
| 1024 | } | ||
| 1025 | } | ||
| 1026 | diff --git a/src/System.Drawing.Common/src/System/Drawing/Design/CategoryNameCollection.cs b/src/System.Drawing.Common/src/System/Drawing/Design/CategoryNameCollection.cs | ||
| 1027 | index 065498c3ad..fcc4f8b2b6 100644 | ||
| 1028 | --- a/src/System.Drawing.Common/src/System/Drawing/Design/CategoryNameCollection.cs | ||
| 1029 | +++ b/src/System.Drawing.Common/src/System/Drawing/Design/CategoryNameCollection.cs | ||
| 1030 | @@ -16,34 +16,34 @@ namespace System.Drawing.Design | ||
| 1031 | /// Initializes a new instance of <see cref='CategoryNameCollection'/> based on another | ||
| 1032 | /// <see cref='CategoryNameCollection'/>. | ||
| 1033 | /// </summary> | ||
| 1034 | - public CategoryNameCollection(CategoryNameCollection value) => InnerList.AddRange(value); | ||
| 1035 | + public CategoryNameCollection(CategoryNameCollection value) { InnerList.AddRange(value); } | ||
| 1036 | |||
| 1037 | /// <summary> | ||
| 1038 | /// Initializes a new instance of <see cref='CategoryNameCollection'/> containing any array of | ||
| 1039 | /// <see cref='string'/> objects. | ||
| 1040 | /// </summary> | ||
| 1041 | - public CategoryNameCollection(string[] value) => InnerList.AddRange(value); | ||
| 1042 | + public CategoryNameCollection(string[] value) { InnerList.AddRange(value); } | ||
| 1043 | |||
| 1044 | /// <summary> | ||
| 1045 | /// Represents the entry at the specified index of the <see cref='string'/>. | ||
| 1046 | /// </summary> | ||
| 1047 | - public string this[int index] => ((string)(InnerList[index])); | ||
| 1048 | + public string this[int index] { get { return ((string)(InnerList[index])); } } | ||
| 1049 | |||
| 1050 | /// <summary> | ||
| 1051 | /// Gets a value indicating whether the <see cref='CategoryNameCollection'/> contains the specified | ||
| 1052 | /// <see cref='string'/>. | ||
| 1053 | /// </summary> | ||
| 1054 | - public bool Contains(string value) => InnerList.Contains(value); | ||
| 1055 | + public bool Contains(string value) { return InnerList.Contains(value); } | ||
| 1056 | |||
| 1057 | /// <summary> | ||
| 1058 | /// Copies the <see cref='CategoryNameCollection'/> values to a one-dimensional <see cref='Array'/> instance | ||
| 1059 | /// at the specified index. | ||
| 1060 | /// </summary> | ||
| 1061 | - public void CopyTo(string[] array, int index) => InnerList.CopyTo(array, index); | ||
| 1062 | + public void CopyTo(string[] array, int index) { InnerList.CopyTo(array, index); } | ||
| 1063 | |||
| 1064 | /// <summary> | ||
| 1065 | /// Returns the index of a <see cref='string'/> in the <see cref='CategoryNameCollection'/> . | ||
| 1066 | /// </summary> | ||
| 1067 | - public int IndexOf(string value) => InnerList.IndexOf(value); | ||
| 1068 | + public int IndexOf(string value) { return InnerList.IndexOf(value); } | ||
| 1069 | } | ||
| 1070 | } | ||
| 1071 | diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs | ||
| 1072 | index 152474117d..d9769778c7 100644 | ||
| 1073 | --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs | ||
| 1074 | +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs | ||
| 1075 | @@ -38,7 +38,7 @@ namespace System.Drawing.Drawing2D | ||
| 1076 | SetNativeLineCap(nativeLineCap); | ||
| 1077 | } | ||
| 1078 | |||
| 1079 | - internal CustomLineCap(IntPtr nativeLineCap) => SetNativeLineCap(nativeLineCap); | ||
| 1080 | + internal CustomLineCap(IntPtr nativeLineCap) { SetNativeLineCap(nativeLineCap); } | ||
| 1081 | |||
| 1082 | internal void SetNativeLineCap(IntPtr handle) | ||
| 1083 | { | ||
| 1084 | @@ -72,7 +72,7 @@ namespace System.Drawing.Drawing2D | ||
| 1085 | _disposed = true; | ||
| 1086 | } | ||
| 1087 | |||
| 1088 | - ~CustomLineCap() => Dispose(false); | ||
| 1089 | + ~CustomLineCap() { Dispose(false); } | ||
| 1090 | |||
| 1091 | public object Clone() | ||
| 1092 | { | ||
| 1093 | diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs | ||
| 1094 | index cb9c34c62a..3b552f1baf 100644 | ||
| 1095 | --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs | ||
| 1096 | +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs | ||
| 1097 | @@ -58,7 +58,7 @@ namespace System.Drawing.Drawing2D | ||
| 1098 | } | ||
| 1099 | } | ||
| 1100 | |||
| 1101 | - ~GraphicsPathIterator() => Dispose(false); | ||
| 1102 | + ~GraphicsPathIterator() { Dispose(false); } | ||
| 1103 | |||
| 1104 | public int NextSubpath(out int startIndex, out int endIndex, out bool isClosed) | ||
| 1105 | { | ||
| 1106 | diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsState.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsState.cs | ||
| 1107 | index c7d086756e..61de948b2d 100644 | ||
| 1108 | --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsState.cs | ||
| 1109 | +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsState.cs | ||
| 1110 | @@ -8,7 +8,7 @@ namespace System.Drawing.Drawing2D | ||
| 1111 | { | ||
| 1112 | internal int nativeState; | ||
| 1113 | |||
| 1114 | - internal GraphicsState(int nativeState) => this.nativeState = nativeState; | ||
| 1115 | + internal GraphicsState(int nativeState) { this.nativeState = nativeState; } | ||
| 1116 | } | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | diff --git a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/RegionData.cs b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/RegionData.cs | ||
| 1120 | index 596b8622eb..dfa2446c87 100644 | ||
| 1121 | --- a/src/System.Drawing.Common/src/System/Drawing/Drawing2D/RegionData.cs | ||
| 1122 | +++ b/src/System.Drawing.Common/src/System/Drawing/Drawing2D/RegionData.cs | ||
| 1123 | @@ -6,7 +6,7 @@ namespace System.Drawing.Drawing2D | ||
| 1124 | { | ||
| 1125 | public sealed class RegionData | ||
| 1126 | { | ||
| 1127 | - internal RegionData(byte[] data) => Data = data; | ||
| 1128 | + internal RegionData(byte[] data) { Data = data; } | ||
| 1129 | |||
| 1130 | public byte[] Data { get; set; } | ||
| 1131 | } | ||
| 1132 | diff --git a/src/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs b/src/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs | ||
| 1133 | index df2ac5c8c2..a451dc621d 100644 | ||
| 1134 | --- a/src/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs | ||
| 1135 | +++ b/src/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs | ||
| 1136 | @@ -14,7 +14,7 @@ namespace System.Drawing.Text | ||
| 1137 | { | ||
| 1138 | internal IntPtr _nativeFontCollection; | ||
| 1139 | |||
| 1140 | - internal FontCollection() => _nativeFontCollection = IntPtr.Zero; | ||
| 1141 | + internal FontCollection() { _nativeFontCollection = IntPtr.Zero; } | ||
| 1142 | |||
| 1143 | /// <summary> | ||
| 1144 | /// Disposes of this <see cref='System.Drawing.Text.FontCollection'/> | ||
| 1145 | @@ -58,6 +58,6 @@ namespace System.Drawing.Text | ||
| 1146 | } | ||
| 1147 | } | ||
| 1148 | |||
| 1149 | - ~FontCollection() => Dispose(false); | ||
| 1150 | + ~FontCollection() { Dispose(false); } | ||
| 1151 | } | ||
| 1152 | } | ||
| 1153 | diff --git a/src/System.Linq.Expressions/src/System/Dynamic/Utils/TypeExtensions.cs b/src/System.Linq.Expressions/src/System/Dynamic/Utils/TypeExtensions.cs | ||
| 1154 | index c45caba093..ef9a25203d 100644 | ||
| 1155 | --- a/src/System.Linq.Expressions/src/System/Dynamic/Utils/TypeExtensions.cs | ||
| 1156 | +++ b/src/System.Linq.Expressions/src/System/Dynamic/Utils/TypeExtensions.cs | ||
| 1157 | @@ -65,7 +65,8 @@ namespace System.Dynamic.Utils | ||
| 1158 | internal static ParameterInfo[] GetParametersCached(this MethodBase method) | ||
| 1159 | { | ||
| 1160 | CacheDict<MethodBase, ParameterInfo[]> pic = s_paramInfoCache; | ||
| 1161 | - if (!pic.TryGetValue(method, out ParameterInfo[] pis)) | ||
| 1162 | + ParameterInfo[] pis; | ||
| 1163 | + if (!pic.TryGetValue(method, out pis)) | ||
| 1164 | { | ||
| 1165 | pis = method.GetParameters(); | ||
| 1166 | |||
| 1167 | diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs | ||
| 1168 | index d8b1c61f74..8cefbd4f19 100644 | ||
| 1169 | --- a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs | ||
| 1170 | +++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs | ||
| 1171 | @@ -952,8 +952,9 @@ namespace System.Linq.Expressions.Compiler | ||
| 1172 | private void EmitMemberAssignment(MemberAssignment binding, Type objectType) | ||
| 1173 | { | ||
| 1174 | EmitExpression(binding.Expression); | ||
| 1175 | - if (binding.Member is FieldInfo fi) | ||
| 1176 | + if (binding.Member is FieldInfo) | ||
| 1177 | { | ||
| 1178 | + FieldInfo fi = (FieldInfo)binding.Member; | ||
| 1179 | _ilg.Emit(OpCodes.Stfld, fi); | ||
| 1180 | } | ||
| 1181 | else | ||
| 1182 | @@ -1097,7 +1098,7 @@ namespace System.Linq.Expressions.Compiler | ||
| 1183 | private static Type GetMemberType(MemberInfo member) | ||
| 1184 | { | ||
| 1185 | Debug.Assert(member is FieldInfo || member is PropertyInfo); | ||
| 1186 | - return member is FieldInfo fi ? fi.FieldType : (member as PropertyInfo).PropertyType; | ||
| 1187 | + return member is FieldInfo ? ((FieldInfo)member).FieldType : (member as PropertyInfo).PropertyType; | ||
| 1188 | } | ||
| 1189 | |||
| 1190 | #endregion | ||
| 1191 | diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberAssignment.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberAssignment.cs | ||
| 1192 | index 475a6c63cc..0787b10186 100644 | ||
| 1193 | --- a/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberAssignment.cs | ||
| 1194 | +++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberAssignment.cs | ||
| 1195 | @@ -93,23 +93,23 @@ namespace System.Linq.Expressions | ||
| 1196 | |||
| 1197 | // Null paramName as there are two paths here with different parameter names at the API | ||
| 1198 | TypeUtils.ValidateType(decType, null); | ||
| 1199 | - switch (member) | ||
| 1200 | + if (member is PropertyInfo) | ||
| 1201 | { | ||
| 1202 | - case PropertyInfo pi: | ||
| 1203 | - if (!pi.CanWrite) | ||
| 1204 | - { | ||
| 1205 | - throw Error.PropertyDoesNotHaveSetter(pi, nameof(member)); | ||
| 1206 | - } | ||
| 1207 | - | ||
| 1208 | - memberType = pi.PropertyType; | ||
| 1209 | - break; | ||
| 1210 | - | ||
| 1211 | - case FieldInfo fi: | ||
| 1212 | - memberType = fi.FieldType; | ||
| 1213 | - break; | ||
| 1214 | - | ||
| 1215 | - default: | ||
| 1216 | - throw Error.ArgumentMustBeFieldInfoOrPropertyInfo(nameof(member)); | ||
| 1217 | + PropertyInfo pi = (PropertyInfo) member; | ||
| 1218 | + if (!pi.CanWrite) | ||
| 1219 | + { | ||
| 1220 | + throw Error.PropertyDoesNotHaveSetter(pi, nameof(member)); | ||
| 1221 | + } | ||
| 1222 | + memberType = pi.PropertyType; | ||
| 1223 | + } | ||
| 1224 | + else if (member is FieldInfo) | ||
| 1225 | + { | ||
| 1226 | + FieldInfo fi = (FieldInfo) member; | ||
| 1227 | + memberType = fi.FieldType; | ||
| 1228 | + } | ||
| 1229 | + else | ||
| 1230 | + { | ||
| 1231 | + throw Error.ArgumentMustBeFieldInfoOrPropertyInfo(nameof(member)); | ||
| 1232 | } | ||
| 1233 | } | ||
| 1234 | } | ||
| 1235 | diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberBinding.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberBinding.cs | ||
| 1236 | index c1c5884618..43c0698f90 100644 | ||
| 1237 | --- a/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberBinding.cs | ||
| 1238 | +++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberBinding.cs | ||
| 1239 | @@ -61,6 +61,9 @@ namespace System.Linq.Expressions | ||
| 1240 | return ExpressionStringBuilder.MemberBindingToString(this); | ||
| 1241 | } | ||
| 1242 | |||
| 1243 | - internal virtual void ValidateAsDefinedHere(int index) => throw Error.UnknownBindingType(index); | ||
| 1244 | + internal virtual void ValidateAsDefinedHere(int index) | ||
| 1245 | + { | ||
| 1246 | + throw Error.UnknownBindingType(index); | ||
| 1247 | + } | ||
| 1248 | } | ||
| 1249 | } | ||
| 1250 | diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberMemberBinding.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberMemberBinding.cs | ||
| 1251 | index f3981a2b1f..75dd7141da 100644 | ||
| 1252 | --- a/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberMemberBinding.cs | ||
| 1253 | +++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberMemberBinding.cs | ||
| 1254 | @@ -127,23 +127,24 @@ namespace System.Linq.Expressions | ||
| 1255 | |||
| 1256 | // Null paramName as there are several paths here with different parameter names at the API | ||
| 1257 | TypeUtils.ValidateType(decType, null, allowByRef: true, allowPointer: true); | ||
| 1258 | - switch (member) | ||
| 1259 | + if (member is PropertyInfo) | ||
| 1260 | { | ||
| 1261 | - case PropertyInfo pi: | ||
| 1262 | - if (!pi.CanRead) | ||
| 1263 | - { | ||
| 1264 | - throw Error.PropertyDoesNotHaveGetter(pi, nameof(member)); | ||
| 1265 | - } | ||
| 1266 | - | ||
| 1267 | - memberType = pi.PropertyType; | ||
| 1268 | - break; | ||
| 1269 | - | ||
| 1270 | - case FieldInfo fi: | ||
| 1271 | - memberType = fi.FieldType; | ||
| 1272 | - break; | ||
| 1273 | + PropertyInfo pi = (PropertyInfo)member; | ||
| 1274 | + if (!pi.CanRead) | ||
| 1275 | + { | ||
| 1276 | + throw Error.PropertyDoesNotHaveGetter(pi, nameof(member)); | ||
| 1277 | + } | ||
| 1278 | |||
| 1279 | - default: | ||
| 1280 | - throw Error.ArgumentMustBeFieldInfoOrPropertyInfo(nameof(member)); | ||
| 1281 | + memberType = pi.PropertyType; | ||
| 1282 | + } | ||
| 1283 | + else if (member is FieldInfo) | ||
| 1284 | + { | ||
| 1285 | + FieldInfo fi = (FieldInfo)member; | ||
| 1286 | + memberType = fi.FieldType; | ||
| 1287 | + } | ||
| 1288 | + else | ||
| 1289 | + { | ||
| 1290 | + throw Error.ArgumentMustBeFieldInfoOrPropertyInfo(nameof(member)); | ||
| 1291 | } | ||
| 1292 | } | ||
| 1293 | |||
| 1294 | diff --git a/src/System.Linq/src/System/Linq/Reverse.cs b/src/System.Linq/src/System/Linq/Reverse.cs | ||
| 1295 | index e68a4f42ee..a6352779b0 100644 | ||
| 1296 | --- a/src/System.Linq/src/System/Linq/Reverse.cs | ||
| 1297 | +++ b/src/System.Linq/src/System/Linq/Reverse.cs | ||
| 1298 | @@ -103,19 +103,24 @@ namespace System.Linq | ||
| 1299 | { | ||
| 1300 | if (onlyIfCheap) | ||
| 1301 | { | ||
| 1302 | - switch (_source) | ||
| 1303 | + if (_source is IIListProvider<TSource>) | ||
| 1304 | { | ||
| 1305 | - case IIListProvider<TSource> listProv: | ||
| 1306 | - return listProv.GetCount(onlyIfCheap: true); | ||
| 1307 | - | ||
| 1308 | - case ICollection<TSource> colT: | ||
| 1309 | - return colT.Count; | ||
| 1310 | - | ||
| 1311 | - case ICollection col: | ||
| 1312 | - return col.Count; | ||
| 1313 | - | ||
| 1314 | - default: | ||
| 1315 | - return -1; | ||
| 1316 | + IIListProvider<TSource> listProv = (IIListProvider<TSource>)_source; | ||
| 1317 | + return listProv.GetCount(onlyIfCheap: true); | ||
| 1318 | + } | ||
| 1319 | + else if (_source is ICollection<TSource>) | ||
| 1320 | + { | ||
| 1321 | + ICollection<TSource> colT = (ICollection<TSource>) _source; | ||
| 1322 | + return colT.Count; | ||
| 1323 | + } | ||
| 1324 | + else if (_source is ICollection) | ||
| 1325 | + { | ||
| 1326 | + ICollection col = (ICollection) _source; | ||
| 1327 | + return col.Count; | ||
| 1328 | + } | ||
| 1329 | + else | ||
| 1330 | + { | ||
| 1331 | + return -1; | ||
| 1332 | } | ||
| 1333 | } | ||
| 1334 | |||
| 1335 | diff --git a/src/System.Net.HttpListener/src/System/Net/WebSockets/HttpListenerWebSocketContext.cs b/src/System.Net.HttpListener/src/System/Net/WebSockets/HttpListenerWebSocketContext.cs | ||
| 1336 | index 5321578946..ff54677027 100644 | ||
| 1337 | --- a/src/System.Net.HttpListener/src/System/Net/WebSockets/HttpListenerWebSocketContext.cs | ||
| 1338 | +++ b/src/System.Net.HttpListener/src/System/Net/WebSockets/HttpListenerWebSocketContext.cs | ||
| 1339 | @@ -94,8 +94,9 @@ namespace System.Net.WebSockets | ||
| 1340 | if (!(user is WindowsPrincipal)) | ||
| 1341 | { | ||
| 1342 | // AuthenticationSchemes.Basic. | ||
| 1343 | - if (user.Identity is HttpListenerBasicIdentity basicIdentity) | ||
| 1344 | + if (user.Identity is HttpListenerBasicIdentity) | ||
| 1345 | { | ||
| 1346 | + HttpListenerBasicIdentity basicIdentity = (HttpListenerBasicIdentity)user.Identity; | ||
| 1347 | return new GenericPrincipal(new HttpListenerBasicIdentity(basicIdentity.Name, basicIdentity.Password), null); | ||
| 1348 | } | ||
| 1349 | } | ||
