forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththis_keyword.js
46 lines (39 loc) · 1.42 KB
/
this_keyword.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// RUN: %hermes -hermes-parser -dump-ir %s | %FileCheckOrRegen %s --match-full-lines
// RUN: %hermes -hermes-parser -dump-ir %s -O
function f1() {
return this;
}
function f2(){
"use strict"; // see strict mode
return this;
}
// Auto-generated content below. Please do not modify manually.
// CHECK:function global#0()#1 : undefined
// CHECK-NEXT:globals = [f1, f2]
// CHECK-NEXT:S{global#0()#1} = []
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{global#0()#1}
// CHECK-NEXT: %1 = CreateFunctionInst %f1#0#1()#2, %0
// CHECK-NEXT: %2 = StorePropertyInst %1 : closure, globalObject : object, "f1" : string
// CHECK-NEXT: %3 = CreateFunctionInst %f2#0#1()#3, %0
// CHECK-NEXT: %4 = StorePropertyInst %3 : closure, globalObject : object, "f2" : string
// CHECK-NEXT: %5 = ReturnInst undefined : undefined
// CHECK-NEXT:function_end
// CHECK:function f1#0#1()#2
// CHECK-NEXT:S{f1#0#1()#2} = []
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{f1#0#1()#2}
// CHECK-NEXT: %1 = ReturnInst %this
// CHECK-NEXT:function_end
// CHECK:function f2#0#1()#3
// CHECK-NEXT:S{f2#0#1()#3} = []
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{f2#0#1()#3}
// CHECK-NEXT: %1 = ReturnInst %this
// CHECK-NEXT:function_end