From f3feb9327aa3df03d5bdc831721a5e50ebbb144d Mon Sep 17 00:00:00 2001 From: JordanBoltonMN Date: Thu, 9 Jun 2022 08:28:25 -0700 Subject: [PATCH] Combine the union of ErrorHandlers into common attribute name (#320) --- package-lock.json | 4 ++-- package.json | 2 +- src/powerquery-parser/language/ast/ast.ts | 16 ++++++++-------- src/powerquery-parser/parser/parsers/naive.ts | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0ed7e983..52ee5c38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@microsoft/powerquery-parser", - "version": "0.9.0", + "version": "0.9.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@microsoft/powerquery-parser", - "version": "0.9.0", + "version": "0.9.1", "license": "MIT", "dependencies": { "grapheme-splitter": "^1.0.4", diff --git a/package.json b/package.json index cf351b2f..74108a81 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/powerquery-parser/language/ast/ast.ts b/src/powerquery-parser/language/ast/ast.ts index a2780759..586901fa 100644 --- a/src/powerquery-parser/language/ast/ast.ts +++ b/src/powerquery-parser/language/ast/ast.ts @@ -561,21 +561,21 @@ export const enum ErrorHandlerKind { Otherwise = "Otherwise", } -export interface IErrorHandlingExpression extends INode { +export interface IErrorHandlingExpression extends INode { readonly kind: NodeKind.ErrorHandlingExpression; - readonly handlerKind: T; + readonly handlerKind: K; readonly isLeaf: false; readonly tryConstant: IConstant; readonly protectedExpression: TExpression; + readonly maybeHandler: H | undefined; } -export interface ErrorHandlingCatchExpression extends IErrorHandlingExpression { - readonly catchExpression: CatchExpression; -} +export type ErrorHandlingCatchExpression = IErrorHandlingExpression; -export interface ErrorHandlingOtherwiseExpression extends IErrorHandlingExpression { - readonly maybeOtherwiseExpression: OtherwiseExpression | undefined; -} +export type ErrorHandlingOtherwiseExpression = IErrorHandlingExpression< + ErrorHandlerKind.Otherwise, + OtherwiseExpression +>; export type TErrorHandlingExpression = ErrorHandlingCatchExpression | ErrorHandlingOtherwiseExpression; diff --git a/src/powerquery-parser/parser/parsers/naive.ts b/src/powerquery-parser/parser/parsers/naive.ts index 9f0855fa..3780843e 100644 --- a/src/powerquery-parser/parser/parsers/naive.ts +++ b/src/powerquery-parser/parser/parsers/naive.ts @@ -2716,7 +2716,7 @@ export async function readErrorHandlingExpression( isLeaf: false, tryConstant, protectedExpression, - catchExpression, + maybeHandler: catchExpression, }; result = errorHandlingCatchExpression; @@ -2745,7 +2745,7 @@ export async function readErrorHandlingExpression( isLeaf: false, tryConstant, protectedExpression, - maybeOtherwiseExpression, + maybeHandler: maybeOtherwiseExpression, }; result = errorHandlingOtherwiseExpression;