Closed Bug 1663889 Opened 4 years ago Closed 4 years ago

Remove JS::CompileForNonSyntacticScope

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

Now JS::CompileForNonSyntacticScope is just a wrapper for JS::Compile's underlying-impl with options.setNonSyntacticScope(true).

https://searchfox.org/mozilla-central/rev/b2716c233e9b4398fc5923cbe150e7f83c7c6c5b/js/src/vm/CompilationAndEvaluation.cpp#113-127

JSScript* JS::CompileForNonSyntacticScope(
    JSContext* cx, const ReadOnlyCompileOptions& optionsArg,
    SourceText<char16_t>& srcBuf) {
  CompileOptions options(cx, optionsArg);
  options.setNonSyntacticScope(true);
  return CompileSourceBuffer(cx, options, srcBuf);
}

JSScript* JS::CompileForNonSyntacticScope(
    JSContext* cx, const ReadOnlyCompileOptions& optionsArg,
    SourceText<Utf8Unit>& srcBuf) {
  CompileOptions options(cx, optionsArg);
  options.setNonSyntacticScope(true);
  return CompileSourceBuffer(cx, options, srcBuf);
}

Having separate API for this isn't good when we want to introduce stencil-related compilation API, given it doubles the variants.
There's no consumer that depends on options not being modified (except testcase),
so all callsites can be replaced with options.setNonSyntacticScope(true) + JS::Compile.

This will simplify bug 1660940 (JS::CompileToStencil), and also bug 1662273 (if we go with composite API for "compile + start XDR encode").

Blocks: stencil-mvp
No longer blocks: 1660940
Priority: P3 → P1
Blocks: 1663962
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/7e4eab0c0430 Remove JS::CompileForNonSyntacticScope and set CompileOptions in caller. r=tcampbell
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: