From e546487ec03dda4d3c0f497272f83632907694fa Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Sat, 14 Mar 2020 00:25:20 +0800 Subject: [PATCH] fix test --- src/compiler/compile/render_ssr/handlers/AwaitBlock.ts | 2 +- test/parser/samples/await-catch/output.json | 5 ++++- test/parser/samples/await-then-catch/output.json | 10 ++++++++-- .../samples/no-error-if-before-closing/output.json | 10 ++++++++-- .../samples/await-then-destruct-array/_config.js | 4 ++-- .../samples/await-then-destruct-object/_config.js | 4 ++-- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/compiler/compile/render_ssr/handlers/AwaitBlock.ts b/src/compiler/compile/render_ssr/handlers/AwaitBlock.ts index af803f4057..d6bb86f1a4 100644 --- a/src/compiler/compile/render_ssr/handlers/AwaitBlock.ts +++ b/src/compiler/compile/render_ssr/handlers/AwaitBlock.ts @@ -14,7 +14,7 @@ export default function(node: AwaitBlock, renderer: Renderer, options: RenderOpt renderer.add_expression(x` function(__value) { if (@is_promise(__value)) return ${pending}; - return (function(${node.value.pattern}) { return ${then}; }(__value)); + return (function(${node.value ? node.value.pattern : ''}) { return ${then}; }(__value)); }(${node.expression.node}) `); } diff --git a/test/parser/samples/await-catch/output.json b/test/parser/samples/await-catch/output.json index 2461f467f2..d47d27e4cb 100644 --- a/test/parser/samples/await-catch/output.json +++ b/test/parser/samples/await-catch/output.json @@ -25,7 +25,10 @@ "name": "thePromise" }, "value": null, - "error": "theError", + "error": { + "type": "Identifier", + "name": "theError" + }, "pending": { "start": 19, "end": 39, diff --git a/test/parser/samples/await-then-catch/output.json b/test/parser/samples/await-then-catch/output.json index d9defb6932..01dc89f3f9 100644 --- a/test/parser/samples/await-then-catch/output.json +++ b/test/parser/samples/await-then-catch/output.json @@ -24,8 +24,14 @@ }, "name": "thePromise" }, - "value": "theValue", - "error": "theError", + "value": { + "type": "Identifier", + "name": "theValue" + }, + "error": { + "type": "Identifier", + "name": "theError" + }, "pending": { "start": 19, "end": 39, diff --git a/test/parser/samples/no-error-if-before-closing/output.json b/test/parser/samples/no-error-if-before-closing/output.json index 251cefc0ca..e30c302e0f 100644 --- a/test/parser/samples/no-error-if-before-closing/output.json +++ b/test/parser/samples/no-error-if-before-closing/output.json @@ -115,7 +115,10 @@ "value": true, "raw": "true" }, - "value": "f", + "value": { + "type": "Identifier", + "name": "f" + }, "error": null, "pending": { "start": 80, @@ -198,7 +201,10 @@ "value": true, "raw": "true" }, - "value": "f", + "value": { + "type": "Identifier", + "name": "f" + }, "error": null, "pending": { "start": 123, diff --git a/test/runtime/samples/await-then-destruct-array/_config.js b/test/runtime/samples/await-then-destruct-array/_config.js index a636eb12b8..55c48481e0 100644 --- a/test/runtime/samples/await-then-destruct-array/_config.js +++ b/test/runtime/samples/await-then-destruct-array/_config.js @@ -30,7 +30,7 @@ export default { try { await (component.thePromise = Promise.reject(['a', [6, 7]])); - } catch { + } catch (e) { // do nothing } @@ -45,7 +45,7 @@ export default { try { await (component.thePromise = Promise.reject(['b', [8, 9]])); - } catch { + } catch (e) { // do nothing } diff --git a/test/runtime/samples/await-then-destruct-object/_config.js b/test/runtime/samples/await-then-destruct-object/_config.js index af39b43640..371462de97 100644 --- a/test/runtime/samples/await-then-destruct-object/_config.js +++ b/test/runtime/samples/await-then-destruct-object/_config.js @@ -32,7 +32,7 @@ export default { await (component.thePromise = Promise.reject({ error: { message: "oops", code: "123" } })); - } catch { + } catch (e) { // do nothing } @@ -48,7 +48,7 @@ export default { await (component.thePromise = Promise.reject({ error: { message: "timeout", code: "456" } })); - } catch { + } catch (e) { // do nothing }