Skip to content

Commit 299ad9a

Browse files
committed
Typescript fixes
- Fix "always" - Allow null bodies on loops (e.g. `while (doSomething());`) - Fix boolean typo
1 parent 966a6c2 commit 299ad9a

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

dist/php-parser.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ AST.prototype.resolvePrecedence = function (result, parser) {
302302
} else if (result.kind === "unary") {
303303
// https://github.com/glayzzle/php-parser/issues/75
304304
if (result.what && !result.what.parenthesizedExpression) {
305-
// unary precedence is allways lower
305+
// unary precedence is always lower
306306
if (result.what.kind === "bin") {
307307
buffer = result.what;
308308
result.what = result.what.left;
@@ -383,7 +383,7 @@ AST.prototype.prepare = function (kind, docs, parser) {
383383
} // if with source, need location on swapLocations function
384384

385385

386-
location = new Location(src, start, new Position(parser.prev[0], parser.prev[1], parser.prev[2])); // last argument is allways the location
386+
location = new Location(src, start, new Position(parser.prev[0], parser.prev[1], parser.prev[2])); // last argument is always the location
387387

388388
args.push(location);
389389
} // handle lazy kind definitions
@@ -3634,7 +3634,7 @@ var KIND = "try";
36343634
* @extends {Statement}
36353635
* @property {Block} body
36363636
* @property {Catch[]} catches
3637-
* @property {Block} allways
3637+
* @property {Block} always
36383638
*/
36393639

36403640
module.exports = Statement["extends"](KIND, function Try(body, catches, always, docs, location) {
@@ -11219,4 +11219,4 @@ module.exports = Object.freeze(tokens);
1121911219
/******/ return __webpack_exports__;
1122011220
/******/ })()
1122111221
;
11222-
});
11222+
});

docs/Try.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ <h5 class="subsection-title">Properties:</h5>
232232

233233
<tr>
234234

235-
<td class="name"><code>allways</code></td>
235+
<td class="name"><code>always</code></td>
236236

237237

238238
<td class="type">
@@ -800,4 +800,4 @@ <h5>Parameters:</h5>
800800

801801

802802
</body>
803-
</html>
803+
</html>

docs/ast.js.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ <h1 class="page-title">
379379
} else if (result.kind === "unary") {
380380
// https://github.com/glayzzle/php-parser/issues/75
381381
if (result.what &amp;&amp; !result.what.parenthesizedExpression) {
382-
// unary precedence is allways lower
382+
// unary precedence is always lower
383383
if (result.what.kind === "bin") {
384384
buffer = result.what;
385385
result.what = result.what.left;
@@ -478,7 +478,7 @@ <h1 class="page-title">
478478
} else {
479479
location = new Location(src, null, null);
480480
}
481-
// last argument is allways the location
481+
// last argument is always the location
482482
args.push(location);
483483
}
484484
// handle lazy kind definitions

docs/ast_try.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ <h1 class="page-title">
120120
* @extends {Statement}
121121
* @property {Block} body
122122
* @property {Catch[]} catches
123-
* @property {Block} allways
123+
* @property {Block} always
124124
*/
125125
module.exports = Statement.extends(KIND, function Try(
126126
body,

src/ast.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ AST.prototype.resolvePrecedence = function (result, parser) {
307307
} else if (result.kind === "unary") {
308308
// https://github.com/glayzzle/php-parser/issues/75
309309
if (result.what && !result.what.parenthesizedExpression) {
310-
// unary precedence is allways lower
310+
// unary precedence is always lower
311311
if (result.what.kind === "bin") {
312312
buffer = result.what;
313313
result.what = result.what.left;
@@ -394,7 +394,7 @@ AST.prototype.prepare = function (kind, docs, parser) {
394394
start,
395395
new Position(parser.prev[0], parser.prev[1], parser.prev[2])
396396
);
397-
// last argument is allways the location
397+
// last argument is always the location
398398
args.push(location);
399399
}
400400
// handle lazy kind definitions

src/ast/try.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const KIND = "try";
1515
* @extends {Statement}
1616
* @property {Block} body
1717
* @property {Catch[]} catches
18-
* @property {Block} allways
18+
* @property {Block} always
1919
*/
2020
module.exports = Statement.extends(
2121
KIND,

types.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ declare module "php-parser" {
260260
*/
261261
class Do extends Statement {
262262
test: Expression;
263-
body: Statement;
263+
body: Statement | null;
264264
}
265265
/**
266266
* Defines system based call
@@ -397,7 +397,7 @@ declare module "php-parser" {
397397
init: Expression[];
398398
test: Expression[];
399399
increment: Expression[];
400-
body: Statement;
400+
body: Statement | null;
401401
shortForm: boolean;
402402
}
403403
/**
@@ -407,7 +407,7 @@ declare module "php-parser" {
407407
source: Expression;
408408
key: Expression | null;
409409
value: Expression;
410-
body: Statement;
410+
body: Statement | null;
411411
shortForm: boolean;
412412
}
413413
/**
@@ -701,7 +701,7 @@ declare module "php-parser" {
701701
parseFlags(flags: (number | null)[]): void;
702702
properties: Property[];
703703
visibility: string|null;
704-
isStatic: bool;
704+
isStatic: boolean;
705705
}
706706
/**
707707
* Defines a reference node
@@ -818,7 +818,7 @@ declare module "php-parser" {
818818
class Try extends Statement {
819819
body: Block;
820820
catches: Catch[];
821-
allways: Block;
821+
always: Block;
822822
}
823823
/**
824824
* Defines a class reference node
@@ -906,7 +906,7 @@ declare module "php-parser" {
906906
*/
907907
class While extends Statement {
908908
test: Expression;
909-
body: Statement;
909+
body: Statement | null;
910910
shortForm: boolean;
911911
}
912912
/**

0 commit comments

Comments
 (0)