Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Unified Diff: src/api.cc

Issue 2695713014: [api] Use CHECK instead of DCHECK for IsModule tests in ScriptCompiler (Closed)
Patch Set: Fix build Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 9e242382c3fec54e159b723aa51c516dc8cee6f1..b175a263c4e5a9667e87b3bb5863f52c40702cb0 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2178,7 +2178,10 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundScript(
Isolate* v8_isolate, Source* source, CompileOptions options) {
- DCHECK(!source->GetResourceOptions().IsModule());
+ Utils::ApiCheck(
+ !source->GetResourceOptions().IsModule(),
+ "v8::ScriptCompiler::CompileUnboundScript",
+ "v8::ScriptCompiler::CompileModule must be used to compile modules");
return CompileUnboundInternal(v8_isolate, source, options);
}
@@ -2186,7 +2189,10 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundScript(
Local<UnboundScript> ScriptCompiler::CompileUnbound(Isolate* v8_isolate,
Source* source,
CompileOptions options) {
- DCHECK(!source->GetResourceOptions().IsModule());
+ Utils::ApiCheck(
+ !source->GetResourceOptions().IsModule(),
+ "v8::ScriptCompiler::CompileUnbound",
+ "v8::ScriptCompiler::CompileModule must be used to compile modules");
RETURN_TO_LOCAL_UNCHECKED(CompileUnboundInternal(v8_isolate, source, options),
UnboundScript);
}
@@ -2195,7 +2201,9 @@ Local<UnboundScript> ScriptCompiler::CompileUnbound(Isolate* v8_isolate,
MaybeLocal<Script> ScriptCompiler::Compile(Local<Context> context,
Source* source,
CompileOptions options) {
- DCHECK(!source->GetResourceOptions().IsModule());
+ Utils::ApiCheck(
+ !source->GetResourceOptions().IsModule(), "v8::ScriptCompiler::Compile",
+ "v8::ScriptCompiler::CompileModule must be used to compile modules");
auto isolate = context->GetIsolate();
auto maybe = CompileUnboundInternal(isolate, source, options);
Local<UnboundScript> result;
@@ -2217,7 +2225,9 @@ MaybeLocal<Module> ScriptCompiler::CompileModule(Isolate* isolate,
Source* source) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- DCHECK(source->GetResourceOptions().IsModule());
+ Utils::ApiCheck(source->GetResourceOptions().IsModule(),
+ "v8::ScriptCompiler::CompileModule",
+ "Invalid ScriptOrigin: is_module must be true");
auto maybe = CompileUnboundInternal(isolate, source, kNoCompileOptions);
Local<UnboundScript> unbound;
if (!maybe.ToLocal(&unbound)) return MaybeLocal<Module>();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698