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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 429013002: Make Dart_LoadLibrary and Dart_LoadSource take line and column offsets like Dart_LoadScript. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 years, 5 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 | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 0277fad9f7d527d7ec040e73dc0bb56ed447db1c..c6022b52f03dfc5da00fb5e5775b8b87d24b9dde 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -4803,7 +4803,7 @@ static void CompileSource(Isolate* isolate,
DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url,
Dart_Handle source,
intptr_t line_offset,
- intptr_t col_offset) {
+ intptr_t column_offset) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
TIMERSCOPE(isolate, time_script_loading);
@@ -4826,8 +4826,8 @@ DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url,
return Api::NewError("%s: argument 'line_offset' must be positive number",
CURRENT_FUNC);
}
- if (col_offset < 0) {
- return Api::NewError("%s: argument 'col_offset' must be positive number",
+ if (column_offset < 0) {
+ return Api::NewError("%s: argument 'column_offset' must be positive number",
CURRENT_FUNC);
}
CHECK_CALLBACK_STATE(isolate);
@@ -4841,7 +4841,7 @@ DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url,
const Script& script = Script::Handle(
isolate, Script::New(url_str, source_str, RawScript::kScriptTag));
- script.SetLocationOffset(line_offset, col_offset);
+ script.SetLocationOffset(line_offset, column_offset);
Dart_Handle result;
CompileSource(isolate, library, script, &result);
return result;
@@ -5059,7 +5059,9 @@ DART_EXPORT Dart_Handle Dart_LibraryHandleError(Dart_Handle library_in,
DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url,
- Dart_Handle source) {
+ Dart_Handle source,
+ intptr_t line_offset,
+ intptr_t column_offset) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
TIMERSCOPE(isolate, time_script_loading);
@@ -5071,6 +5073,14 @@ DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url,
if (source_str.IsNull()) {
RETURN_TYPE_ERROR(isolate, source, String);
}
+ if (line_offset < 0) {
+ return Api::NewError("%s: argument 'line_offset' must be positive number",
+ CURRENT_FUNC);
+ }
+ if (column_offset < 0) {
+ return Api::NewError("%s: argument 'column_offset' must be positive number",
+ CURRENT_FUNC);
+ }
CHECK_CALLBACK_STATE(isolate);
NoHeapGrowthControlScope no_growth_control;
@@ -5089,6 +5099,7 @@ DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url,
}
const Script& script = Script::Handle(
isolate, Script::New(url_str, source_str, RawScript::kLibraryTag));
+ script.SetLocationOffset(line_offset, column_offset);
Dart_Handle result;
CompileSource(isolate, library, script, &result);
// Propagate the error out right now.
@@ -5154,7 +5165,9 @@ DART_EXPORT Dart_Handle Dart_LibraryImportLibrary(Dart_Handle library,
DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library,
Dart_Handle url,
- Dart_Handle source) {
+ Dart_Handle source,
+ intptr_t line_offset,
+ intptr_t column_offset) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
TIMERSCOPE(isolate, time_script_loading);
@@ -5170,12 +5183,21 @@ DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library,
if (source_str.IsNull()) {
RETURN_TYPE_ERROR(isolate, source, String);
}
+ if (line_offset < 0) {
+ return Api::NewError("%s: argument 'line_offset' must be positive number",
+ CURRENT_FUNC);
+ }
+ if (column_offset < 0) {
+ return Api::NewError("%s: argument 'column_offset' must be positive number",
+ CURRENT_FUNC);
+ }
CHECK_CALLBACK_STATE(isolate);
NoHeapGrowthControlScope no_growth_control;
const Script& script = Script::Handle(
isolate, Script::New(url_str, source_str, RawScript::kSourceTag));
+ script.SetLocationOffset(line_offset, column_offset);
Dart_Handle result;
CompileSource(isolate, lib, script, &result);
return result;
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698