Skip to content

Commit 4c94c4f

Browse files
committed
Replace "statement block" with "block" everywhere
Section 12.3 (blocks) just refers to blocks, e.g.: > A *block* permits multiple statements to be written in contexts where a single statement is allowed. So there's no need to use "statement block" anywhere else. Fixes #506.
1 parent c9abd21 commit 4c94c4f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

standard/classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2987,7 +2987,7 @@ When the effective return type of a method is not `void` and the method has an e
29872987
> }
29882988
> ```
29892989
>
2990-
> the value-returning `Fmethod results in a compile-time error because control can flow off the end of the method body. The `G` and `Hmethods are correct because all possible execution paths end in a return statement that specifies a return value. The `I` method is correct, because its body is equivalent to a statement block with just a single return statement in it.
2990+
> the value-returning `Fmethod results in a compile-time error because control can flow off the end of the method body. The `G` and `Hmethods are correct because all possible execution paths end in a return statement that specifies a return value. The `I` method is correct, because its body is equivalent to a block with just a single return statement in it.
29912991
>
29922992
> *end example*
29932993

standard/conversions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,9 +714,9 @@ Specifically, an anonymous function `F` is compatible with a delegate type `D`
714714
- If `F` has an explicitly typed parameter list, each parameter in `D` has the same type and modifiers as the corresponding parameter in `F`.
715715
- If `F` has an implicitly typed parameter list, `D` has no ref or out parameters.
716716
- If the body of `F` is an expression, and *either* `D` has a void return type *or* `F` is async and `D` has the return type Task, then when each parameter of `F` is given the type of the corresponding parameter in `D`, the body of `F` is a valid expression (w.r.t [§11](expressions.md#11-expressions)) that would be permitted as a *statement_expression* ([§12.7](statements.md#127-expression-statements)).
717-
- If the body of `F` is a statement block, and *either* `D` has a void return type *or* `F` is async and `D` has the return type Task, then when each parameter of `F` is given the type of the corresponding parameter in `D`, the body of `F` is a valid statement block (w.r.t [§12.3](statements.md#123-blocks)) in which no `return` statement specifies an expression.
717+
- If the body of `F` is a block, and *either* `D` has a void return type *or* `F` is async and `D` has the return type Task, then when each parameter of `F` is given the type of the corresponding parameter in `D`, the body of `F` is a valid block (w.r.t [§12.3](statements.md#123-blocks)) in which no `return` statement specifies an expression.
718718
- If the body of `F` is an expression, and *either* `F` is non-async and `D` has a non-`void` return type `T`, *or* `F` is async and `D` has a return type `Task<T>`, then when each parameter of `F` is given the type of the corresponding parameter in `D`, the body of `F` is a valid expression (w.r.t [§11](expressions.md#11-expressions)) that is implicitly convertible to `T`.
719-
- If the body of `F` is a statement block, and *either* `F` is non-async and `D` has a non-void return type `T`, *or* `F` is async and `D` has a return type `Task<T>`, then when each parameter of `F` is given the type of the corresponding parameter in `D`, the body of `F` is a valid statement block (w.r.t [§12.3](statements.md#123-blocks)) with a non-reachable end point in which each return statement specifies an expression that is implicitly convertible to `T`.
719+
- If the body of `F` is a block, and *either* `F` is non-async and `D` has a non-void return type `T`, *or* `F` is async and `D` has a return type `Task<T>`, then when each parameter of `F` is given the type of the corresponding parameter in `D`, the body of `F` is a valid block (w.r.t [§12.3](statements.md#123-blocks)) with a non-reachable end point in which each return statement specifies an expression that is implicitly convertible to `T`.
720720
721721
> *Example*: The following examples illustrate these rules:
722722
>

standard/expressions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ The ***inferred effective return type*** is determined as follows:
841841
842842
The ***inferred return type*** is determined as follows:
843843
844-
- If `F` is async and the body of `F` is either an expression classified as nothing ([§11.2](expressions.md#112-expression-classifications)), or a statement block where no `return` statements have expressions, the inferred return type is `System.Threading.Tasks.Task`.
844+
- If `F` is async and the body of `F` is either an expression classified as nothing ([§11.2](expressions.md#112-expression-classifications)), or a block where no `return` statements have expressions, the inferred return type is `System.Threading.Tasks.Task`.
845845
- If `F` is async and has an inferred effective return type `T`, the inferred return type is `System.Threading.Tasks.Task<T>`.
846846
- If `F` is non-async and has an inferred effective return type `T`, the inferred return type is `T`.
847847
- Otherwise, a return type cannot be inferred for `F`.
@@ -1014,7 +1014,7 @@ Given an expression `E` and a type `T`, `E` ***exactly matches*** `T` if one of
10141014
- An inferred return type `X` exists for `E` in the context of the parameter list of `D` ([§11.6.3.12](expressions.md#116312-fixing)), and an identity conversion exists from `X` to the return type of `D`
10151015
- Either `E` is non-async and `D` has a return type `Y` or `E` is async and `D` has a return type `Task<Y>`, and one of the following holds:
10161016
- The body of `E` is an expression that exactly matches `Y`
1017-
- The body of `E` is a statement block where every return statement returns an expression that exactly matches `Y`
1017+
- The body of `E` is a block where every return statement returns an expression that exactly matches `Y`
10181018
10191019
#### 11.6.4.6 Better conversion target
10201020
@@ -4759,7 +4759,7 @@ The behavior of *lambda_expression*s and *anonymous_method_expression*s is the s
47594759

47604760
- *anonymous_method_expression*s permit the parameter list to be omitted entirely, yielding convertibility to delegate types of any list of value parameters.
47614761
- *lambda_expression*s permit parameter types to be omitted and inferred whereas *anonymous_method_expression*s require parameter types to be explicitly stated.
4762-
- The body of a *lambda_expression* can be an expression or a statement block whereas the body of an *anonymous_method_expression* shall be a statement block.
4762+
- The body of a *lambda_expression* can be an expression or a block whereas the body of an *anonymous_method_expression* shall be a block.
47634763
- Only *lambda_expression*s have conversions to compatible expression tree types ([§8.6](types.md#86-expression-tree-types)).
47644764

47654765
### 11.16.2 Anonymous function signatures
@@ -5218,7 +5218,7 @@ class Test
52185218
}
52195219
```
52205220

5221-
Here, a compiler-generated class is created for each statement 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 statement 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 statement 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.
5221+
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.
52225222

52235223
```csharp
52245224
class Test

0 commit comments

Comments
 (0)