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

Unified Diff: src/compiler.cc

Issue 776563002: Better message location for 'super(...)' restriction error. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: One more Created 6 years 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 | test/message/super-constructor.js » ('j') | test/message/testcfg.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 546ac887421ab2e10f251ec038d98f049dc37755..c4949dcc9ed0859811fe7dc82396773321cbe12c 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -762,15 +762,14 @@ static bool Renumber(CompilationInfo* info) {
}
-static void ThrowSuperConstructorCheckError(CompilationInfo* info) {
+static void ThrowSuperConstructorCheckError(CompilationInfo* info,
+ Statement* stmt) {
MaybeHandle<Object> obj = info->isolate()->factory()->NewTypeError(
"super_constructor_call", HandleVector<Object>(nullptr, 0));
Handle<Object> exception;
if (!obj.ToHandle(&exception)) return;
- FunctionLiteral* lit = info->function();
- MessageLocation location(info->script(), lit->start_position(),
- lit->end_position());
+ MessageLocation location(info->script(), stmt->position(), stmt->position());
USE(info->isolate()->Throw(*exception, &location));
}
@@ -801,20 +800,20 @@ static bool CheckSuperConstructorCall(CompilationInfo* info) {
break;
}
- ExpressionStatement* exprStm =
- body->at(super_call_index)->AsExpressionStatement();
+ Statement* stmt = body->at(super_call_index);
+ ExpressionStatement* exprStm = stmt->AsExpressionStatement();
if (exprStm == nullptr) {
- ThrowSuperConstructorCheckError(info);
+ ThrowSuperConstructorCheckError(info, stmt);
return false;
}
Call* callExpr = exprStm->expression()->AsCall();
if (callExpr == nullptr) {
- ThrowSuperConstructorCheckError(info);
+ ThrowSuperConstructorCheckError(info, stmt);
return false;
}
if (!callExpr->expression()->IsSuperReference()) {
- ThrowSuperConstructorCheckError(info);
+ ThrowSuperConstructorCheckError(info, stmt);
return false;
}
@@ -825,7 +824,7 @@ static bool CheckSuperConstructorCall(CompilationInfo* info) {
if (this_access_visitor.HasStackOverflow()) return false;
if (this_access_visitor.UsesThis()) {
- ThrowSuperConstructorCheckError(info);
+ ThrowSuperConstructorCheckError(info, stmt);
return false;
}
« no previous file with comments | « no previous file | test/message/super-constructor.js » ('j') | test/message/testcfg.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698