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

Unified Diff: src/parser.cc

Issue 316173002: Handle "//# sourceURL" comments in the Parser instead of the JS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: match ContentSearchUtils even more Created 6 years, 6 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
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 369a451f350c543e3c193a5a332eb8c9e8fef0f0..67f67db721d98be5c2de59a46e01ba26bfec002c 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -891,6 +891,9 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
bool ok = true;
int beg_pos = scanner()->location().beg_pos;
ParseSourceElements(body, Token::EOS, info->is_eval(), true, &ok);
+
+ HandleMagicComments();
+
if (ok && strict_mode() == STRICT) {
CheckOctalLiteral(beg_pos, scanner()->location().end_pos, &ok);
}
@@ -3835,6 +3838,18 @@ void Parser::RegisterTargetUse(Label* target, Target* stop) {
}
+void Parser::HandleMagicComments() {
Sven Panne 2014/06/13 10:37:49 Can we use a better name for this? I'm quite sure
marja 2014/06/13 11:15:29 Renamed to HandleSourceURLComments. (Though, the t
+ if (scanner_.source_url()->length() > 0) {
+ info_->script()->set_source_url(
+ *scanner_.source_url()->Internalize(isolate()));
+ }
+ if (scanner_.source_mapping_url()->length() > 0) {
+ info_->script()->set_source_mapping_url(
+ *scanner_.source_mapping_url()->Internalize(isolate()));
+ }
+}
+
+
void Parser::ThrowPendingError() {
if (has_pending_error_) {
MessageLocation location(script_,

Powered by Google App Engine
This is Rietveld 408576698