You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -2348,7 +2348,7 @@ Use of `this` in a *primary_expression* in a context other than the ones listed
2348
2348
2349
2349
### 12.8.15 Base access
2350
2350
2351
-
A *base_access* consists of the keyword base followed by either a “`.`” token and an identifier and optional *type_argument_list* or an *argument_list* enclosed in square brackets:
2351
+
A *base_access* consists of the keyword `base` followed by either a “`.`” token and an identifier and optional *type_argument_list* or an *argument_list* enclosed in square brackets:
2352
2352
2353
2353
```ANTLR
2354
2354
base_access
@@ -2357,7 +2357,7 @@ base_access
2357
2357
;
2358
2358
```
2359
2359
2360
-
A *base_access* is used to access base class members that are hidden by similarly named members in the current class or struct. A *base_access* is permitted only in the body of an instance constructor, an instance method, an instance accessor ([§12.2.1](expressions.md#1221-general)), or a finalizer. When `base.I` occurs in a class or struct, I shall denote a member of the base class of that class or struct. Likewise, when `base[E]` occurs in a class, an applicable indexer shall exist in the base class.
2360
+
A *base_access* is used to access base class members that are hidden by similarly named members in the current class or struct. A *base_access* is permitted only in the body of an instance constructor, an instance method, an instance accessor ([§12.2.1](expressions.md#1221-general)), or a finalizer. When `base.I` occurs in a class or struct, `I` shall denote a member of the base class of that class or struct. Likewise, when `base[E]` occurs in a class, an applicable indexer shall exist in the base class.
2361
2361
2362
2362
At binding-time, *base_access* expressions of the form `base.I` and `base[E]` are evaluated exactly as if they were written `((B)this).I` and `((B)this)[E]`, where `B` is the base class of the class or struct in which the construct occurs. Thus, `base.I` and `base[E]` correspond to `this.I` and `this[E]`, except `this` is viewed as an instance of the base class.
2363
2363
@@ -2448,7 +2448,7 @@ Processing of an object creation expression that includes an object initializer
2448
2448
2449
2449
If any of the arguments in the optional *argument_list* has the compile-time type `dynamic` then the *object_creation_expression* is dynamically bound ([§12.3.3](expressions.md#1233-dynamic-binding)) and the following rules are applied at run-time using the run-time type of those arguments of the *argument_list* that have the compile-time type `dynamic`. However, the object creation undergoes a limited compile-time check as described in [§12.6.5](expressions.md#1265-compile-time-checking-of-dynamic-member-invocation).
2450
2450
2451
-
The binding-time processing of an *object_creation_expression* of the form new `T(A)`, where `T` is a *class_type*, or a *value_type*, and `A` is an optional *argument_list*, consists of the following steps:
2451
+
The binding-time processing of an *object_creation_expression* of the form `new T(A)`, where `T` is a *class_type*, or a *value_type*, and `A` is an optional *argument_list*, consists of the following steps:
2452
2452
2453
2453
- If `T` is a *value_type* and `A` is not present:
2454
2454
- The *object_creation_expression* is a default constructor invocation. The result of the *object_creation_expression* is a value of type `T`, namely the default value for `T` as defined in [§8.3.3](types.md#833-default-constructors).
@@ -2457,7 +2457,7 @@ The binding-time processing of an *object_creation_expression* of the form new `
2457
2457
- The result of the *object_creation_expression* is a value of the run-time type that the type parameter has been bound to, namely the result of invoking the default constructor of that type. The run-time type may be a reference type or a value type.
2458
2458
- Otherwise, if `T` is a *class_type* or a *struct_type*:
2459
2459
- If `T` is an abstract or static *class_type*, a compile-time error occurs.
2460
-
- The instance constructor to invoke is determined using the overload resolution rules of [§12.6.4](expressions.md#1264-overload-resolution). The set of candidate instance constructors consists of all accessible instance constructors declared in `T`, which are applicable with respect to A ([§12.6.4.2](expressions.md#12642-applicable-function-member)). If the set of candidate instance constructors is empty, or if a single best instance constructor cannot be identified, a binding-time error occurs.
2460
+
- The instance constructor to invoke is determined using the overload resolution rules of [§12.6.4](expressions.md#1264-overload-resolution). The set of candidate instance constructors consists of all accessible instance constructors declared in `T`, which are applicable with respect to `A` ([§12.6.4.2](expressions.md#12642-applicable-function-member)). If the set of candidate instance constructors is empty, or if a single best instance constructor cannot be identified, a binding-time error occurs.
2461
2461
- The result of the *object_creation_expression* is a value of type `T`, namely the value produced by invoking the instance constructor determined in the step above.
2462
2462
- Otherwise, the *object_creation_expression* is invalid, and a binding-time error occurs.
2463
2463
@@ -2661,7 +2661,8 @@ A collection initializer consists of a sequence of element initializers, enclose
2661
2661
2662
2662
Thecollectionobjecttowhichacollectioninitializerisappliedshallbeofatypethatimplements `System.Collections.IEnumerable` oracompile-timeerroroccurs. Foreachspecifiedelementinorderfromlefttoright, normalmemberlookupisappliedtofindamembernamed `Add`. Iftheresultofthememberlookupisnotamethodgroup, acompile-timeerroroccurs. Otherwise, overloadresolutionisappliedwiththeexpressionlistoftheelementinitializerastheargumentlist, andthecollectioninitializerinvokestheresultingmethod. Thus, thecollectionobjectshallcontainanapplicableinstanceorextensionmethodwiththename `Add` for each element initializer.
2663
2663
2664
-
> *Example*:The following shows a class that represents a contact with a name and a list of phone numbers, and the creation and initialization of a `List<Contact>`:
2664
+
> *Example*:
2665
+
> The following shows a class that represents a contact with a name and a list of phone numbers, and the creation and initialization of a `List<Contact>`:
@@ -3582,8 +3583,7 @@ The run-time processing of a prefix increment or decrement operation of the form
3582
3583
- If `x` is classified as a variable:
3583
3584
-`x` is evaluated to produce the variable.
3584
3585
- The value of `x` is converted to the operand type of the selected operator and the operator is invoked with this value as its argument.
3585
-
- The value returned by the operator is converted to the type of `x`. The resulting value is stored in the location given by the evaluation of `x`.
3586
-
- and becomes the result of the operation.
3586
+
- The value returned by the operator is converted to the type of `x`. The resulting value is stored in the location given by the evaluation of `x` and becomes the result of the operation.
3587
3587
- If `x` is classified as a property or indexer access:
3588
3588
- The instance expression (if `x` is not `static`) and the argument list (if `x` is an indexer access) associated with `x` are evaluated, and the results are used in the subsequent get and set accessor invocations.
3589
3589
- The get accessor of `x` is invoked.
@@ -3747,7 +3747,7 @@ The predefined multiplication operators are listed below. The operators all comp
(Except were otherwise noted, in the floating-point tables in [§12.10.2](expressions.md#12102-multiplication-operator)–[§12.10.6](expressions.md#12106-subtraction-operator) the use of “`+`” means the value is positive; the use of “`-`” means the value is negative; and the lack of a sign means the value may be positive or negative or has no sign (NaN).)
3750
+
(Except where otherwise noted, in the floating-point tables in [§12.10.2](expressions.md#12102-multiplication-operator)–[§12.10.6](expressions.md#12106-subtraction-operator) the use of “`+`” means the value is positive; the use of “`-`” means the value is negative; and the lack of a sign means the value may be positive or negative or has no sign (NaN).)
Two delegate instances are considered equal as follows:
4459
4459
4460
4460
- If either of the delegate instances is `null`, they are equal if and only if both are `null`.
4461
-
- If the delegates have different run-time type, they are never equal.
4461
+
- If the delegates have different run-time types, they are never equal.
4462
4462
- If both of the delegate instances have an invocation list ([§20.2](delegates.md#202-delegate-declarations)), those instances are equal if and only if their invocation lists are the same length, and each entry in one’s invocation list is equal (as defined below) to the corresponding entry, in order, in the other’s invocation list.
4463
4463
4464
4464
The following rules govern the equality of invocation list entries:
@@ -4529,7 +4529,7 @@ The *is-type operator* is used to check if the run-time type of an object is com
4529
4529
4530
4530
The operation is evaluated as follows:
4531
4531
4532
-
1. If `E` is an anonymous function or method group, a compile-time error occurs
4532
+
1. If `E` is an anonymous function or method group, a compile-time error occurs.
4533
4533
1. If `E` is the `null` literal, or if the value of `E` is `null`, the result is `false`.
4534
4534
1. Otherwise:
4535
4535
1. Let `R` be the runtime type of `E`.
@@ -4630,7 +4630,7 @@ Note that some conversions, such as user defined conversions, are not possible w
4630
4630
4631
4631
### 12.13.1 General
4632
4632
4633
-
The `&,` `^`, and `|` operatorsarecalledthelogicaloperators.
4633
+
The `&`, `^`, and `|` operatorsarecalledthelogicaloperators.
4634
4634
4635
4635
```ANTLR
4636
4636
and_expression
@@ -4816,7 +4816,7 @@ The type of the expression `a ?? b` depends on which implicit conversions are
4816
4816
- If `A` exists and is not a nullable value type or a reference type, a compile-time error occurs.
4817
4817
- Otherwise, if `A` exists and `b` is a dynamic expression, the result type is `dynamic`. At run-time, `a` is first evaluated. If `a` is not `null`, `a` is converted to `dynamic`, and this becomes the result. Otherwise, `b` is evaluated, and this becomes the result.
4818
4818
- Otherwise, if `A` exists and is a nullable value type and an implicit conversion exists from `b` to `A₀`, the result type is `A₀`. At run-time, `a` is first evaluated. If `a` is not `null`, `a` is unwrapped to type `A₀`, and this becomes the result. Otherwise, `b` is evaluated and converted to type `A₀`, and this becomes the result.
4819
-
- Otherwise, if `A` exists and an implicit conversion exists from `b` to `A`, the result type is `A`. At run-time, a is first evaluated. If a is not null, a becomes the result. Otherwise, `b` is evaluated and converted to type `A`, and this becomes the result.
4819
+
- Otherwise, if `A` exists and an implicit conversion exists from `b` to `A`, the result type is `A`. At run-time, `a` is first evaluated. If `a` is not `null`, `a` becomes the result. Otherwise, `b` is evaluated and converted to type `A`, and this becomes the result.
4820
4820
- Otherwise, if `A` exists and is a nullable value type, `b` has a type `B` and an implicit conversion exists from `A₀` to `B`, the result type is `B`. At run-time, `a` is first evaluated. If `a` is not `null`, `a` is unwrapped to type `A₀` and converted to type `B`, and this becomes the result. Otherwise, `b` is evaluated and becomes the result.
4821
4821
- Otherwise, if `b` has a type `B` and an implicit conversion exists from `a` to `B`, the result type is `B`. At run-time, `a` is first evaluated. If `a` is not `null`, `a` is converted to type `B`, and this becomes the result. Otherwise, `b` is evaluated and becomes the result.
4822
4822
@@ -5501,7 +5501,7 @@ class Test
5501
5501
}
5502
5502
```
5503
5503
5504
-
This can be translated to a delegate instantiation that references a compilergenerated static method in which the code of the anonymous function is placed:
5504
+
This can be translated to a delegate instantiation that references a compiler-generated static method in which the code of the anonymous function is placed:
The lifetime of the local variable must now be extended to at least the lifetime of the anonymous function delegate. This can be achieved by “hoisting” the local variable into a field of a compiler-generated class. Instantiation of the local variable ([§12.19.6.3](expressions.md#121963-instantiation-of-local-variables)) then corresponds to creating an instance of the compilergenerated class, and accessing the local variable corresponds to accessing a field in the instance of the compilergenerated class. Furthermore, the anonymous function becomes an instance method of the compiler-generated class:
5579
+
The lifetime of the local variable must now be extended to at least the lifetime of the anonymous function delegate. This can be achieved by “hoisting” the local variable into a field of a compiler-generated class. Instantiation of the local variable ([§12.19.6.3](expressions.md#121963-instantiation-of-local-variables)) then corresponds to creating an instance of the compiler-generated class, and accessing the local variable corresponds to accessing a field in the instance of the compiler-generated class. Furthermore, the anonymous function becomes an instance method of the compiler-generated class:
Here, a compiler-generated class is created for each block in which locals are captured such that the locals in the different blocks can have independent lifetimes. An instance of `__Locals2`, the compilergenerated class for the inner block, contains the local variable `z` and a field that references an instance of `__Locals1`. An instance of `__Locals1`, the compilergenerated class for the outer block, contains the local variable `y` and a field that references `this` of the enclosing function member. With these data structures, it is possible to reach all captured outer variables through an instance of `__Local2`, and the code of the anonymous function can thus be implemented as an instance method of that class.
5628
+
Here, a compiler-generated class is created for each block in which locals are captured such that the locals in the different blocks can have independent lifetimes. An instance of `__Locals2`, the compiler-generated class for the inner block, contains the local variable `z` and a field that references an instance of `__Locals1`. An instance of `__Locals1`, the compiler-generated class for the outer block, contains the local variable `y` and a field that references `this` of the enclosing function member. With these data structures, it is possible to reach all captured outer variables through an instance of `__Local2`, and the code of the anonymous function can thus be implemented as an instance method of that class.
0 commit comments