From 73320217c2c0703c962d1314f2c0103319d29d0e Mon Sep 17 00:00:00 2001 From: zhangbao Date: Tue, 31 Mar 2020 10:43:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E2=80=9C=E6=8A=BD=E8=B1=A1?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E7=9A=84=E8=BF=90=E8=A1=8C=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E2=80=9D=E7=9A=84=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改了两处: 1)步骤描述 `ReturnIfAbrupt(result)` 应该描述为: > 1. If result is an abrupt completion, return result. > 2. Set result to result.[[Value]] 而非 > 1. If resultCompletionRecord is an abrupt completion, return resultCompletionRecord. > 2. Let result be resultCompletionRecord.[[Value]]. 改写之后,方便简写前后的对照,而不至于对不上号。 另外,第一步也修改为:Let result be AbstractOp() “Set result to result.[[Value]]”的写法参考了这里的:https://v8.dev/blog/understanding-ecmascript-part-1#completion-records 2) 简化了步骤之后的文字描述 --- docs/spec.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/spec.md b/docs/spec.md index f1c1e0e..30aa2c4 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -70,12 +70,12 @@ F.[[Call]](V, argumentsList) 抽象操作的运行流程,一般是下面这样。 -> 1. Let `resultCompletionRecord` be `AbstractOp()`. -> 1. If `resultCompletionRecord` is an abrupt completion, return `resultCompletionRecord`. -> 1. Let `result` be `resultCompletionRecord.[[Value]]`. +> 1. Let `result` be `AbstractOp()`. +> 1. If `result` is an abrupt completion, return `result`. +> 1. Set `result` to `result.[[Value]]`. > 1. return `result`. -上面的第一步是调用抽象操作`AbstractOp()`,得到`resultCompletionRecord`,这是一个 Completion Record。第二步,如果这个 Record 属于 abrupt completion,就将`resultCompletionRecord`返回给用户。如果此处没有返回,就表示运行结果正常,所得的值存放在`resultCompletionRecord.[[Value]]`属性。第三步,将这个值记为`result`。第四步,将`result`返回给用户。 +上面的第一步调用了抽象操作`AbstractOp()`,得到`result`,这是一个 Completion Record。第二步,如果`result`属于 abrupt completion,就直接返回。如果此处没有返回,表示`result`属于 normal completion。第三步,将`result`的值设置为`resultCompletionRecord.[[Value]]`。第四步,返回`result`。 ES6 规格将这个标准流程,使用简写的方式表达。