From 8a4aa7a0de94400df3e65b178f6bb6c898f60c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Mon, 31 Oct 2022 05:54:53 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E7=AC=AC=E4=B9=9D?= =?UTF-8?q?=E6=AC=A1=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/.keep" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/.keep" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 98ec275c9bfb9dff08a44c773077d1233b1a12cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Mon, 31 Oct 2022 05:55:02 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\224\350\256\260/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/.keep" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/.keep" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 409039e03ad87c185038a7204d5cd7f50694e781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Mon, 31 Oct 2022 05:55:29 +0000 Subject: [PATCH 3/4] =?UTF-8?q?add=2022=20=E6=9D=A8=E5=87=8C=E7=BF=94/?= =?UTF-8?q?=E7=AC=AC=E4=B9=9D=E6=AC=A1=E4=BD=9C=E4=B8=9A/=E7=AC=94?= =?UTF-8?q?=E8=AE=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨凌翔 <963304364@qq.com> --- ...9-\351\242\204\347\274\226\350\257\221.md" | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-10-29-\351\242\204\347\274\226\350\257\221.md" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-10-29-\351\242\204\347\274\226\350\257\221.md" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-10-29-\351\242\204\347\274\226\350\257\221.md" new file mode 100644 index 0000000..9af531a --- /dev/null +++ "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/\347\254\224\350\256\260/2022-10-29-\351\242\204\347\274\226\350\257\221.md" @@ -0,0 +1,75 @@ +# 预编译AO&GO + +### AO 指活动性对象,也叫执行期上下文,就是我们通常所说的作用域。这里指函数的局部作用域。 + +AO步骤: + +创建AO(Activation Object)对象,又叫执行期上下文; +寻找形式参数和变量声明作为AO的属性名,并赋值为undefined; +传入实际参数的值; +在函数体内寻找函数声明,放入作为AO的属性,并赋值为其函数体。 + +调用时,先在函数内部进行js预解析 + + 1. 先创建AO对象 AO{} + + 2. 把形参和变量声明作为对象的属性 + + AO { + + a: undefined // 形参a和变量声明的a一样,只需写一个 + + b: undefined + + } + + 3. 把实参和形参值统一 + + AO { + + a: 2 + + b: 2 + + } + + 4. 在函数体中找函数声明,值赋为函数体 + + AO { + + a: 2 + + b: 2 + + arr: function () {}; + + } + +### GO 是全局对象,GO对象跟window对象是同一个对象。可以理解为window对象有两个名字 window == GO。 + +GO步骤: + +创建GO(Global Object)对象; +寻找变量声明作为GO的属性名,并赋值为undefined; +寻找函数声明,放入作为GO的属性,并赋值为其函数体。 +同样进行预解析 + + 1.创建GO对象 GO {} + + 2.把声明的变量给到GO的属性 赋值为undefined + + GO { + + b: undefined + + } + + 3. 找全局域中的函数声明,放到GO对象的属性,赋值为函数体 + + GO { + + b: undefined + + arr: function aaa() {} + + } 预解析完毕,执行代码 \ No newline at end of file -- Gitee From 168ee5c98d838e5c360a0bb61a56149bc89f34a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=87=8C=E7=BF=94?= <963304364@qq.com> Date: Mon, 31 Oct 2022 05:56:05 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\344\275\234\344\270\232/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/.keep" diff --git "a/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/.keep" "b/22 \346\235\250\345\207\214\347\277\224/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232/\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee