Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/test_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ jobs:
unit_tests:
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [18]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node-version }}"
cache: "npm"
Expand All @@ -26,8 +27,8 @@ jobs:
integration_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
Expand All @@ -44,8 +45,8 @@ jobs:
if: startsWith(github.event.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
Expand Down
4 changes: 2 additions & 2 deletions src/parse/parse_parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function parseReturn(parameters: string[], body: string[]): Returns {
const returnType = parseReturnFromDefinition(parameters);

if (returnType == null || isIterator(returnType.type)) {
return parseFromBody(body, /return /);
return parseFromBody(body, /(?:^|\W)return /);
}

return returnType;
Expand All @@ -105,7 +105,7 @@ function parseYields(parameters: string[], body: string[]): Yields {

// To account for functions that yield but don't have a yield signature
const yieldType = returnType ? returnType.type : undefined;
const yieldInBody = parseFromBody(body, /yield /);
const yieldInBody = parseFromBody(body, /(?:^|\W)yield /);

if (yieldInBody != null && yieldType != undefined) {
yieldInBody.type = `Iterator[${yieldType}]`;
Expand Down