Skip to content

Commit c92d4c9

Browse files
Fix number keyword not resolving (#38)
Also add help for `hasdefault` and update manifest
1 parent 2845fdd commit c92d4c9

File tree

4 files changed

+90
-1
lines changed

4 files changed

+90
-1
lines changed

docs/en-US/about_Type_Signatures.help.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Type signatures are a custom query language built into PowerShell type expressio
3030
* [`concrete`](#concrete)
3131
* [`index`](#index)
3232
* [`number`](#number)
33+
* [`hasdefault`](#hasdefault)
3334
* [`decoration`, `hasattr`](#decoration-hasattr)
3435
* [`generic`](#generic)
3536
* [Resolution Maps](#resolution-maps)
@@ -3242,6 +3243,76 @@ public readonly struct DateTime
32423243
</tr>
32433244
</table>
32443245

3246+
## `hasdefault`
3247+
3248+
<sup>([Back to Top](#keywords))</sup>
3249+
3250+
Matches only parameters with a default value.
3251+
3252+
<table>
3253+
<tr>
3254+
<td colspan="2" width="1000">
3255+
3256+
```powershell
3257+
Find-Member -ParameterType { [hasdefault] }
3258+
```
3259+
3260+
</td>
3261+
</tr>
3262+
<tr>
3263+
<th width="1">
3264+
3265+
</th>
3266+
<th>
3267+
3268+
Signature
3269+
3270+
</th>
3271+
</tr>
3272+
<tr>
3273+
<td width="1">
3274+
3275+
:x:
3276+
3277+
</td>
3278+
<td>
3279+
3280+
```csharp
3281+
void Example(string str);
3282+
```
3283+
3284+
</td>
3285+
</tr>
3286+
<tr>
3287+
<td width="1">
3288+
3289+
:heavy_check_mark:
3290+
3291+
</td>
3292+
<td>
3293+
3294+
```csharp
3295+
void Example(string str = "something");
3296+
```
3297+
3298+
</td>
3299+
</tr>
3300+
<tr>
3301+
<td width="1">
3302+
3303+
:heavy_check_mark:
3304+
3305+
</td>
3306+
<td>
3307+
3308+
```csharp
3309+
void Example(CancellationToken token = default);
3310+
```
3311+
3312+
</td>
3313+
</tr>
3314+
</table>
3315+
32453316
## `decoration`, `hasattr`
32463317

32473318
<sup>([Back to Top](#keywords))</sup>

module/ClassExplorer.psd1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'ClassExplorer.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '2.3.0'
15+
ModuleVersion = '2.3.1'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = 'Desktop', 'Core'
@@ -78,6 +78,11 @@ PrivateData = @{
7878

7979
# ReleaseNotes of this module
8080
ReleaseNotes = @'
81+
## 2.3.1
82+
83+
* Fix `number` signature keyword not resolving
84+
* Add help for `hasdefault` keyword
85+
8186
## 2.3.0
8287
8388
* Add `-Extension` parameter to `Find-Member`. This will find only extension methods

src/ClassExplorer/Signatures/SignatureParser.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ public ITypeSignature ParseDefinition(
231231
Keywords.any => new AnySignature(),
232232
Keywords.generic => Consume(ParseGeneric(args, typeName), out argsConsumed),
233233
Keywords.hasdefault => new HasDefaultSignature(),
234+
Keywords.number => new NumberTypeSignature(),
234235
Keywords.decoration or Keywords.hasattr => Consume(Decoration(args, typeName), out argsConsumed),
235236
Keywords.pointer => Consume(ParsePointer(args, typeName), out argsConsumed),
236237
_ => Default(typeName, args),

tools/Signatures.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,18 @@ keywords:
545545
- match: false
546546
sig: public readonly struct DateTime
547547

548+
- header: "`hasdefault`"
549+
description: Matches only parameters with a default value.
550+
examples:
551+
- syntax: Find-Member -ParameterType { [hasdefault] }
552+
signatures:
553+
- match: false
554+
sig: void Example(string str);
555+
- match: true
556+
sig: void Example(string str = "something");
557+
- match: true
558+
sig: void Example(CancellationToken token = default);
559+
548560
- header: "`decoration`, `hasattr`"
549561
description: Matches parameters or types decorated with this attribute.
550562
examples:

0 commit comments

Comments
 (0)