Skip to content

Commit

Permalink
Combine the union of ErrorHandlers into common attribute name (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanBoltonMN authored Jun 9, 2022
1 parent a92fdcf commit f3feb93
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/powerquery-parser",
"version": "0.9.0",
"version": "0.9.1",
"description": "A parser for the Power Query/M formula language.",
"author": "Microsoft",
"license": "MIT",
Expand Down
16 changes: 8 additions & 8 deletions src/powerquery-parser/language/ast/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,21 +561,21 @@ export const enum ErrorHandlerKind {
Otherwise = "Otherwise",
}

export interface IErrorHandlingExpression<T extends ErrorHandlerKind> extends INode {
export interface IErrorHandlingExpression<K extends ErrorHandlerKind, H> extends INode {
readonly kind: NodeKind.ErrorHandlingExpression;
readonly handlerKind: T;
readonly handlerKind: K;
readonly isLeaf: false;
readonly tryConstant: IConstant<Constant.KeywordConstant.Try>;
readonly protectedExpression: TExpression;
readonly maybeHandler: H | undefined;
}

export interface ErrorHandlingCatchExpression extends IErrorHandlingExpression<ErrorHandlerKind.Catch> {
readonly catchExpression: CatchExpression;
}
export type ErrorHandlingCatchExpression = IErrorHandlingExpression<ErrorHandlerKind.Catch, CatchExpression>;

export interface ErrorHandlingOtherwiseExpression extends IErrorHandlingExpression<ErrorHandlerKind.Otherwise> {
readonly maybeOtherwiseExpression: OtherwiseExpression | undefined;
}
export type ErrorHandlingOtherwiseExpression = IErrorHandlingExpression<
ErrorHandlerKind.Otherwise,
OtherwiseExpression
>;

export type TErrorHandlingExpression = ErrorHandlingCatchExpression | ErrorHandlingOtherwiseExpression;

Expand Down
4 changes: 2 additions & 2 deletions src/powerquery-parser/parser/parsers/naive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2716,7 +2716,7 @@ export async function readErrorHandlingExpression(
isLeaf: false,
tryConstant,
protectedExpression,
catchExpression,
maybeHandler: catchExpression,
};

result = errorHandlingCatchExpression;
Expand Down Expand Up @@ -2745,7 +2745,7 @@ export async function readErrorHandlingExpression(
isLeaf: false,
tryConstant,
protectedExpression,
maybeOtherwiseExpression,
maybeHandler: maybeOtherwiseExpression,
};

result = errorHandlingOtherwiseExpression;
Expand Down

0 comments on commit f3feb93

Please sign in to comment.