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

Unified Diff: runtime/lib/errors.cc

Issue 36323003: - Ensure that the token stream from generated source matches the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 | runtime/lib/errors_patch.dart » ('j') | runtime/vm/scanner.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/errors.cc
===================================================================
--- runtime/lib/errors.cc (revision 28974)
+++ runtime/lib/errors.cc (working copy)
@@ -35,13 +35,16 @@
script.GetTokenLocation(assertion_start, &from_line, &from_column);
intptr_t to_line, to_column;
script.GetTokenLocation(assertion_end, &to_line, &to_column);
+ // The snippet will extract the correct assertion code even if the source
+ // is generated.
args.SetAt(0, String::Handle(
script.GetSnippet(from_line, from_column, to_line, to_column)));
// Initialize location arguments starting at position 1.
+ // Do not set a column if the source has been generated as it will be wrong.
args.SetAt(1, String::Handle(script.url()));
args.SetAt(2, Smi::Handle(Smi::New(from_line)));
- args.SetAt(3, Smi::Handle(Smi::New(from_column)));
+ args.SetAt(3, Smi::Handle(Smi::New(script.HasSource() ? from_column : -1)));
Exceptions::ThrowByType(Exceptions::kAssertion, args);
UNREACHABLE();
@@ -89,8 +92,8 @@
iterator.NextFrame(); // Skip native call.
const Script& script = Script::Handle(Exceptions::GetCallerScript(&iterator));
args.SetAt(0, String::Handle(script.url()));
- intptr_t line, column;
- script.GetTokenLocation(fallthrough_pos, &line, &column);
+ intptr_t line;
+ script.GetTokenLocation(fallthrough_pos, &line, NULL);
args.SetAt(1, Smi::Handle(Smi::New(line)));
Exceptions::ThrowByType(Exceptions::kFallThrough, args);
@@ -116,8 +119,8 @@
const Script& script = Script::Handle(Exceptions::GetCallerScript(&iterator));
args.SetAt(0, class_name);
args.SetAt(1, String::Handle(script.url()));
- intptr_t line, column;
- script.GetTokenLocation(error_pos, &line, &column);
+ intptr_t line;
+ script.GetTokenLocation(error_pos, &line, NULL);
args.SetAt(2, Smi::Handle(Smi::New(line)));
Exceptions::ThrowByType(Exceptions::kAbstractClassInstantiation, args);
« no previous file with comments | « no previous file | runtime/lib/errors_patch.dart » ('j') | runtime/vm/scanner.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698