-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabling async functions by default #1691
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
function foo() { | ||
return this.x; /**bp:locals(1);stack()**/ | ||
} | ||
|
||
async function af1(a) { | ||
await a; | ||
return await foo.call({ x : 100 }); /**bp:locals();stack()**/ | ||
} | ||
|
||
async function af2() { | ||
return await af1(10); | ||
} | ||
|
||
var p = af2();/**bp: | ||
resume('step_into');stack(); | ||
resume('step_into');stack(); | ||
resume('step_into');stack(); | ||
**/ | ||
p.then(result => { | ||
if (result === 100) { | ||
print("PASS"); | ||
} | ||
}, | ||
error => { | ||
print("Failed : " + error); | ||
} | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
[ | ||
{ | ||
"callStack": [ | ||
{ | ||
"line": 15, | ||
"column": 4, | ||
"sourceText": "return await af1(10)", | ||
"function": "af2" | ||
}, | ||
{ | ||
"line": 18, | ||
"column": 0, | ||
"sourceText": "var p = af2()", | ||
"function": "Global code" | ||
} | ||
] | ||
}, | ||
{ | ||
"callStack": [ | ||
{ | ||
"line": 10, | ||
"column": 4, | ||
"sourceText": "await a", | ||
"function": "af1" | ||
}, | ||
{ | ||
"line": 15, | ||
"column": 4, | ||
"sourceText": "return await af1(10)", | ||
"function": "af2" | ||
}, | ||
{ | ||
"line": 18, | ||
"column": 0, | ||
"sourceText": "var p = af2()", | ||
"function": "Global code" | ||
} | ||
] | ||
}, | ||
{ | ||
"callStack": [ | ||
{ | ||
"line": 15, | ||
"column": 4, | ||
"sourceText": "return await af1(10)", | ||
"function": "af2" | ||
}, | ||
{ | ||
"line": 18, | ||
"column": 0, | ||
"sourceText": "var p = af2()", | ||
"function": "Global code" | ||
} | ||
] | ||
}, | ||
{ | ||
"this": "Object {...}", | ||
"arguments": "Object {...}", | ||
"locals": { | ||
"a": "number 10" | ||
} | ||
}, | ||
{ | ||
"callStack": [ | ||
{ | ||
"line": 11, | ||
"column": 4, | ||
"sourceText": "return await foo.call({ x : 100 })", | ||
"function": "af1" | ||
} | ||
] | ||
}, | ||
{ | ||
"this": { | ||
"x": "number 100" | ||
}, | ||
"arguments": { | ||
"#__proto__": "Object {...}", | ||
"length": "number 0", | ||
"callee": "function <large string>", | ||
"Symbol.iterator": "function <large string>" | ||
}, | ||
"globals": { | ||
"WScript": "Object {...}", | ||
"print": "function print", | ||
"console": "Object {...}", | ||
"foo": "function <large string>", | ||
"af1": "function <large string>", | ||
"af2": "function <large string>", | ||
"p": "Promise [...]" | ||
} | ||
}, | ||
{ | ||
"callStack": [ | ||
{ | ||
"line": 6, | ||
"column": 4, | ||
"sourceText": "return this.x", | ||
"function": "foo" | ||
}, | ||
{ | ||
"line": 11, | ||
"column": 4, | ||
"sourceText": "return await foo.call({ x : 100 })", | ||
"function": "af1" | ||
} | ||
] | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
function foo() { | ||
return 100; | ||
} | ||
|
||
async function af1(a) { | ||
return await foo(); | ||
} | ||
|
||
async function af2() { | ||
return await af1(10); | ||
} | ||
|
||
var p = 1;/**bp: | ||
resume('step_over'); | ||
resume('step_into'); | ||
resume('step_into'); | ||
resume('step_out');stack(); | ||
resume('step_out');stack();**/ | ||
// If we put the break point in the below line after stepping out from af2 we will execute the same break | ||
// point again which will add more break points. To avoid this adding the break point to a dummy statement. | ||
p = af2(); | ||
|
||
p.then(result => { | ||
if (result === 100) { | ||
print("PASS"); | ||
} | ||
}, | ||
error => { | ||
print("Failed : " + error); | ||
} | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[ | ||
{ | ||
"callStack": [ | ||
{ | ||
"line": 14, | ||
"column": 4, | ||
"sourceText": "return await af1(10)", | ||
"function": "af2" | ||
}, | ||
{ | ||
"line": 25, | ||
"column": 0, | ||
"sourceText": "p = af2()", | ||
"function": "Global code" | ||
} | ||
] | ||
}, | ||
{ | ||
"callStack": [ | ||
{ | ||
"line": 25, | ||
"column": 0, | ||
"sourceText": "p = af2()", | ||
"function": "Global code" | ||
} | ||
] | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
function foo() { | ||
return 100; | ||
} | ||
|
||
async function af1(a) { | ||
return await foo(); | ||
} | ||
|
||
async function af2() { | ||
return await af1(10); | ||
} | ||
|
||
var p = af2();/**bp: | ||
resume('step_into'); | ||
resume('step_into'); | ||
resume('step_over');stack(); | ||
**/ | ||
p.then(result => { | ||
if (result === 100) { | ||
print("PASS"); | ||
} | ||
}, | ||
error => { | ||
print("Failed : " + error); | ||
} | ||
); | ||
|
||
p = af2();/**bp:resume('step_over');stack();**/ | ||
p.then(result => { | ||
if (result === 100) { | ||
print("PASS"); | ||
} | ||
}, | ||
error => { | ||
print("Failed : " + error); | ||
} | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[ | ||
{ | ||
"callStack": [ | ||
{ | ||
"line": 14, | ||
"column": 4, | ||
"sourceText": "return await af1(10)", | ||
"function": "af2" | ||
}, | ||
{ | ||
"line": 17, | ||
"column": 0, | ||
"sourceText": "var p = af2()", | ||
"function": "Global code" | ||
} | ||
] | ||
}, | ||
{ | ||
"callStack": [ | ||
{ | ||
"line": 33, | ||
"column": 0, | ||
"sourceText": "p.then(result => {\r\n if (result === 100) {\r\n print(\"PASS\");\r\n }\r\n },\r\n error => {\r\n print(\"Failed : \" + error);\r\n } \r\n)", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. curious why it is not truncated. Did we change the default, or ch has different default? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sourceText is not truncated, same as PDM (callstack text) baseline behavior. |
||
"function": "Global code" | ||
} | ||
] | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In PDM based debugger baselines I see a frame here "Generator.prototype.next" why is it not here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it seems PDM enables library stack frames and our default value is false so ChakraCore doesn't give it. For now its fine but we may need to expose a functionality to enable this in ChakraCore in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, nice to have that...
In reply to: 82048419 [](ancestors = 82048419)