Skip to content

Commit 83480cb

Browse files
committed
v3.2.0 Release.
1 parent 55c6865 commit 83480cb

24 files changed

Lines changed: 516 additions & 214 deletions

README.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ The `ConstExpression` attribute may only be attached to functions with the follo
154154
<tr>
155155
<td>bool</td>
156156
<td>enum</td>
157+
<td>null</td>
157158
<td>struct<br/>- No reference type instances as members</td>
158-
<td></td>
159159
</tr>
160160
<tr>
161161
<td>ReadOnlyArray&ltstring&gt</td>
@@ -178,8 +178,8 @@ The `ConstExpression` attribute may only be attached to functions with the follo
178178
<tr>
179179
<td>ReadOnlyArray&ltbool&gt</td>
180180
<td>ReadOnlyArray&ltenum&gt</td>
181+
<td>ReadOnlyArray&ltnull&gt</td>
181182
<td>ReadOnlyArray&ltstruct&gt<br/>- No reference type instances as members</td>
182-
<td></td>
183183
</tr>
184184
<tr>
185185
<td>ReadOnlyArray&ltReadOnlyArray&lt...&gt&gt</td>
@@ -236,6 +236,13 @@ int r = 200;
236236
MyConstExpression.Add(l, r);
237237
```
238238

239+
### Disabling ConstExpression
240+
You can disable ConstExpression with the following notation.
241+
```.cs.
242+
[assembly:IgnoreConstExpression]
243+
```
244+
This attribute can also be type or method specific.
245+
239246
## How to Use StaticExpression
240247
### Normal usage
241248
#### Creating Assembly for StaticExpression
@@ -260,10 +267,10 @@ There are several limitations to performing runtime constant pre-computations.
260267
#### StaticExpression属性
261268
Only functions with the `StaticExpression` attribute are subject to runtime constant pre-computations
262269

263-
#### static関数
270+
#### Static Function
264271
The `StaticExpression` attribute can only be attached to static functions.
265272

266-
#### 引数/戻り値
273+
#### Arguments/Return Values
267274
The `StaticExpression` attribute can only be attached to functions with the following argument/return types.
268275
Unlike `ConstExpression`, reflection types can be used.
269276
<table>
@@ -288,12 +295,12 @@ Unlike `ConstExpression`, reflection types can be used.
288295
<tr>
289296
<td>bool</td>
290297
<td>enum</td>
298+
<td>null</td>
291299
<td>struct<br/>- No reference type instances as members</td>
292-
<td>Type</td>
293300
</tr>
294301
<tr>
295302
<td>MemberInfo</td>
296-
<td>TypeInfo</td>
303+
<td>Type/TypeInfo</td>
297304
<td>ConstructorInfo</td>
298305
<td>FieldInfo</td>
299306
</tr>
@@ -324,12 +331,12 @@ Unlike `ConstExpression`, reflection types can be used.
324331
<tr>
325332
<td>ReadOnlyArray&ltbool&gt</td>
326333
<td>ReadOnlyArray&ltenum&gt</td>
334+
<td>ReadOnlyArray&ltnull&gt</td>
327335
<td>ReadOnlyArray&ltstruct&gt<br/>- No reference type instances as members</td>
328-
<td>ReadOnlyArray&ltType&gt</td>
329336
</tr>
330337
<tr>
331338
<td>ReadOnlyArray&ltMemberInfo&gt</td>
332-
<td>ReadOnlyArray&ltTypeInfo&gt</td>
339+
<td>ReadOnlyArray&ltType/TypeInfo&gt</td>
333340
<td>ReadOnlyArray&ltConstructorInfo&gt</td>
334341
<td>ReadOnlyArray&ltFieldInfo&gt</td>
335342
</tr>
@@ -389,7 +396,7 @@ MyStaticExpression.Add(MyStaticExpression.MakeVector2(10, 20), MyStaticExpressio
389396
MyStaticExpression.Add(new Vector2(10, 20), new Vector2(30, 40));
390397
```
391398

392-
##### CalculationFailedWarningオプション
399+
##### CalculationFailedWarning option
393400
Setting the `ConstExpression` attribute to `CalculationFailedWarning=false` will prevent the warning from occurring when assigning a non-constant value to an argument.
394401
```
395402
[StaticExpression(CalculationFailedWarning = false)]
@@ -402,7 +409,15 @@ public static int Add(int l, int r)
402409
MyStaticExpression.Add(l, r);
403410
```
404411

405-
### About ReadOnlyArray
412+
### Disabling StaticExpression
413+
You can disable StaticExpression with the following notation.
414+
```.cs.
415+
[assembly:IgnoreStaticExpression]
416+
```
417+
This attribute can also be type or method specific.
418+
419+
420+
## About ReadOnlyArray
406421
ReadOnlyArray is an immutable array prepared as a return constant for ConstExpression.
407422
It inherits from IReadOnlyList and can be implicitly cast to ReadOnlySpan.
408423
Implicit casts from arrays are also possible.
@@ -418,4 +433,4 @@ IReadOnlyList<byte> listBinary = binary;
418433

419434
// NG
420435
byte[] bytes = binary;
421-
```
436+
```

README_ja.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ public static class MyConstExpression
154154
<tr>
155155
<td>bool</td>
156156
<td>enum</td>
157+
<td>null</td>
157158
<td>struct<br/>- 参照型インスタンスをメンバに持たないこと</td>
158-
<td></td>
159159
</tr>
160160
<tr>
161161
<td>ReadOnlyArray&ltstring&gt</td>
@@ -234,6 +234,13 @@ public static int Add(int l, int r)
234234
MyConstExpression.Add(l, r);
235235
```
236236

237+
### ConstExpressionを無効化する
238+
以下の記法でConstExpressionを無効化できます。
239+
```.cs
240+
[assembly:IgnoreConstExpression]
241+
```
242+
このアトリビュートは型やメソッドに限定して指定することも可能です。
243+
237244
## StaticExpressionの使い方
238245
### 通常の使用法
239246
#### 計算関数を実装する
@@ -286,12 +293,12 @@ public static class MyStaticExpression
286293
<tr>
287294
<td>bool</td>
288295
<td>enum</td>
296+
<td>null</td>
289297
<td>struct<br/>- 参照型インスタンスをメンバに持たないこと</td>
290-
<td>Type</td>
291298
</tr>
292299
<tr>
293300
<td>MemberInfo</td>
294-
<td>TypeInfo</td>
301+
<td>Type/TypeInfo</td>
295302
<td>ConstructorInfo</td>
296303
<td>FieldInfo</td>
297304
</tr>
@@ -322,12 +329,12 @@ public static class MyStaticExpression
322329
<tr>
323330
<td>ReadOnlyArray&ltbool&gt</td>
324331
<td>ReadOnlyArray&ltenum&gt</td>
332+
<td>ReadOnlyArray&ltnull&gt</td>
325333
<td>ReadOnlyArray&ltstruct&gt<br/>- 参照型インスタンスをメンバに持たないこと</td>
326-
<td>ReadOnlyArray&ltType&gt</td>
327334
</tr>
328335
<tr>
329336
<td>ReadOnlyArray&ltMemberInfo&gt</td>
330-
<td>ReadOnlyArray&ltTypeInfo&gt</td>
337+
<td>ReadOnlyArray&ltType/TypeInfo&gt</td>
331338
<td>ReadOnlyArray&ltConstructorInfo&gt</td>
332339
<td>ReadOnlyArray&ltFieldInfo&gt</td>
333340
</tr>
@@ -401,7 +408,15 @@ public static int Add(int l, int r)
401408
MyStaticExpression.Add(l, r);
402409
```
403410

404-
### ReadOnlyArrayについて
411+
### StaticExpressionを無効化する
412+
以下の記法でStaticExpressionを無効化できます。
413+
```.cs
414+
[assembly:IgnoreStaticExpression]
415+
```
416+
このアトリビュートは型やメソッドに限定して指定することも可能です。
417+
418+
419+
## ReadOnlyArrayについて
405420
ReadOnlyArrayはConstExpressionの戻り値定数として用意した不変の配列です。
406421
IReadOnlyListを継承している他、ReadOnlySpanへの暗黙的キャストが可能です。
407422
配列からの暗黙的キャストも可能です。

0 commit comments

Comments
 (0)