OLD | NEW |
---|---|
(Empty) | |
1 Checks Debugger.getPossibleBreakpoints | |
2 // Copyright 2017 the V8 project authors. All rights reserved. | |
3 // Use of this source code is governed by a BSD-style license that can be | |
4 // found in the LICENSE file. | |
5 | |
6 function testEval() { | |
7 #eval('// comment only'); | |
8 #eval('// comment only\n'); | |
9 #} | |
10 | |
11 // function without return | |
12 function procedure() { | |
13 var a = #1; | |
14 var b = #2; | |
15 #} | |
16 | |
17 function testProcedure() { | |
18 #procedure(); | |
19 #} | |
20 | |
21 function returnTrue() { | |
22 #return true; | |
23 #} | |
24 | |
25 function testIf() { | |
26 var a; | |
27 #if (true) #a = true; | |
28 #if (!a) { | |
29 #a = true; | |
30 } else { | |
31 #a = false; | |
32 } | |
33 #if (#returnTrue()) { | |
34 #a = false; | |
35 } else { | |
36 #a = true; | |
37 } | |
38 #} | |
39 | |
40 function emptyFunction() {#} | |
41 | |
42 function testEmptyFunction() { | |
43 #emptyFunction(); | |
44 #} | |
45 | |
46 function twoArguments(a1, a2) { | |
47 #} | |
48 | |
49 function testCallArguments() { | |
50 #twoArguments(#emptyFunction(), #emptyFunction()); | |
51 #} | |
52 | |
53 function testNested() { | |
54 function nested1() { | |
55 function nested2() { | |
56 function nested3() { | |
57 #} | |
58 #nested3(); | |
59 #return; | |
60 #} | |
61 #return #nested2(); | |
62 #} | |
63 #nested1(); | |
64 #} | |
65 | |
66 function return42() { | |
67 #return 42; | |
68 #} | |
69 | |
70 function returnCall() { | |
71 #return #return42(); | |
72 #} | |
73 | |
74 function testCallAtReturn() { | |
75 #return #returnCall(); | |
76 #} | |
77 | |
78 function returnObject() { | |
79 #return ({ foo: () => #42# }); | |
80 #} | |
81 | |
82 function testWith() { | |
83 #with (#returnObject()) { | |
84 #foo(); | |
85 } | |
86 #with({}) { | |
87 #return; | |
88 } | |
89 #} | |
90 | |
91 function testForLoop() { | |
92 for (var i = #0; i #< 1; ++#i) {} | |
93 for (var i = #0; i #< 1; ++#i) #i; | |
94 for (var i = #0; i #< 0; ++#i) {} | |
95 #} | |
96 | |
97 function testForOfLoop() { | |
98 for (var k #of []) {} | |
99 for (var k #of #[1]) #k; | |
100 var a = #[]; | |
101 for (var k #of #a) {} | |
102 #} | |
103 | |
104 function testForInLoop() { | |
105 var o = #{}; | |
106 for (var #k in #o) {} | |
107 for (var #k in #o) #k; | |
108 for (var #k in #{ a:1 }) {} | |
109 for (var #k in #{ a:1 }) #k; | |
110 #} | |
111 | |
112 function testSimpleExpressions() { | |
113 #1 + 2 + 3; | |
114 var a = #1; | |
115 #++a; | |
116 #a--; | |
117 #} | |
118 | |
119 Object.defineProperty(this, 'getterFoo', { | |
120 get: () => #return42# | |
121 }); | |
122 | |
123 function testGetter() { | |
124 #getterFoo(); | |
125 #} | |
126 | |
127 var obj = { | |
128 foo: () => (#{ | |
129 boo: () => #return42# | |
130 })# | |
131 }; | |
132 | |
133 function testChainedCalls() { | |
134 #obj.#foo().#boo()#(); | |
135 #} | |
136 | |
137 function testChainedWithNative() { | |
138 #Array.#from([1]).#concat([2]).#map(v => v #* 2#); | |
139 #} | |
140 | |
141 function testPromiseThen() { | |
142 #return Promise.#resolve().#then(v => v #* 2#).#then(v => v #* 2#); | |
143 #} | |
144 | |
145 function testSwitch() { | |
146 for (var i = #0; i #< 3; ++#i) { | |
147 #switch(i) { | |
148 case 0: #continue; | |
149 case 1: #return42(); #break; | |
150 default: #return; | |
151 } | |
152 } | |
153 #} | |
154 | |
155 function* idMaker() { | |
156 #yield 1; | |
157 #yield 2; | |
158 #yield 3; | |
159 #} | |
160 | |
161 function testGenerator() { | |
162 var gen = #idMaker(); | |
163 #return42(); | |
164 #gen.#next().value; | |
165 #debugger; | |
166 #gen.#next().value; | |
167 #return42(); | |
168 #gen.#next().value; | |
169 #return42(); | |
170 #gen.#next().value; | |
171 #} | |
172 | |
173 function throwException() { | |
174 #throw #new Error(); | |
175 #} | |
176 | |
177 function testCaughtException() { | |
178 try { | |
179 #throwException() | |
180 } catch (e) { | |
181 #return; | |
182 } | |
183 #} | |
184 | |
185 function testClasses() { | |
186 #class Cat { | |
187 constructor(name) { | |
188 #this.name = name; | |
189 #} | |
190 | |
191 speak() { | |
192 #} | |
193 } | |
194 #class Lion extends Cat { | |
195 constructor(name) { | |
196 #super(name); | |
197 #} | |
198 | |
199 speak() { | |
200 #super.#speak(); | |
201 #} | |
202 } | |
203 #new Lion().#speak(); | |
204 #} | |
205 | |
206 async function asyncFoo() { | |
207 #await Promise.resolve().then(v => v #* 2#); | |
208 #return42(); | |
209 #await #asyncBoo(); | |
210 #} | |
211 | |
212 async function asyncBoo() { | |
213 #await Promise.resolve(); | |
214 #} | |
215 | |
216 async function testAsyncAwait() { | |
217 #await asyncFoo(); | |
218 #await #awaitBoo(); | |
219 #} | |
220 | |
221 //# sourceURL=break-locations.js | |
dgozman
2017/02/27 18:01:10
Looks like a break position ;)
kozy
2017/02/27 18:54:19
removed sourceURL comments.
| |
222 | |
OLD | NEW |