Closed Bug 1380498 Opened 7 years ago Closed 7 years ago

[jsdbg2] Debugger.Script and Debugger.Object should identify generators, async functions

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: jimb, Assigned: jimb)

References

Details

Attachments

(1 file, 1 obsolete file)

There should be a simple, reliable way to determine whether a Debugger.Object's or Debugger.Script's referent is a generator or async function.
Blocks: 1316265
Depends on: 1382258
Assignee: nobody → jimb
Status: NEW → ASSIGNED
Attachment #8890544 - Flags: review?(ttromey)
Attachment #8890544 - Attachment description: Add isGeneratorFunction and isAsyncFunction to Debugger.Script and Debugger.Object. → Add isGeneratorFunction and isAsyncFunction to Debugger.Script and Debugger.Object. Depends on patch in bug 1382258.
Comment on attachment 8890544 [details] [diff] [review]
Add isGeneratorFunction and isAsyncFunction to Debugger.Script and Debugger.Object. Depends on patch in bug 1382258.

Review of attachment 8890544 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for doing this.  I found a couple of small things, but the code change itself looks good to me.

::: js/src/doc/Debugger/Debugger.Object.md
@@ +176,5 @@
>      function, or not a function at all, returns `undefined` instead.
>  
> +`isGeneratorFunction`
> +:   True if the referent is a function defined with a `function*` expression or
> +    statement. False otherwise. Always equal to

The implementation actually returns undefined if the object isn't a function, like isArrowFunction does.  I think the docs should follow the isArrowFunction text here.

@@ +181,5 @@
> +    `obj.script.isGeneratorFunction`, assuming `obj.script` is a `Debugger.Script`.
> +
> +`isAsyncFunction`
> +:   True if the referent is an async function, defined with an `async function`
> +    expression or statement. False otherwise. Always equal to

Ditto.

::: js/src/jit-test/tests/debug/isAsyncFunction-isGeneratorFunction.js
@@ +1,1 @@
> +// Debugger.Script.prototype.isAsyncFunction, Debugger.Object.prototype.isAsyncFunction,

I think it would be worthwhile to check some cases where the new functions return 'undefined'.
Attachment #8890544 - Flags: review?(ttromey) → review+
(In reply to Tom Tromey :tromey from comment #2)
> The implementation actually returns undefined if the object isn't a
> function, like isArrowFunction does.  I think the docs should follow the
> isArrowFunction text here.

Fixed, thanks.

> I think it would be worthwhile to check some cases where the new functions
> return 'undefined'.

Fixed, thanks.
Carrying over r+ from tromey
Attachment #8890544 - Attachment is obsolete: true
Attachment #8891086 - Flags: review+
Attachment #8891086 - Attachment description: Add isGeneratorFunction and isAsyncFunction to Debugger.Script and Debugger.Object. → Add isGeneratorFunction and isAsyncFunction to Debugger.Script and Debugger.Object. r=tromey
Attachment #8891086 - Flags: review+
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/aed855892bc9
Add isGeneratorFunction and isAsyncFunction to Debugger.Script and Debugger.Object. r=tromey
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/aed855892bc9
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Depends on: 1386026
You need to log in before you can comment on or make changes to this bug.