@@ -1018,11 +1018,9 @@ RawLibrary* KernelLoader::LoadLibrary(intptr_t index) {
1018
1018
library.SetLoadInProgress ();
1019
1019
}
1020
1020
1021
- StringIndex import_uri_index =
1022
- H.CanonicalNameString (library_helper.canonical_name_ );
1023
1021
library_helper.ReadUntilIncluding (LibraryHelper::kSourceUriIndex );
1024
- const Script& script = Script::Handle (
1025
- Z, ScriptAt (library_helper.source_uri_index_ , library, import_uri_index ));
1022
+ const Script& script =
1023
+ Script::Handle ( Z, ScriptAt (library_helper.source_uri_index_ ));
1026
1024
1027
1025
library_helper.ReadUntilExcluding (LibraryHelper::kAnnotations );
1028
1026
intptr_t annotations_kernel_offset =
@@ -1357,80 +1355,6 @@ void KernelLoader::LoadPreliminaryClass(ClassHelper* class_helper,
1357
1355
}
1358
1356
}
1359
1357
1360
- // Workaround for http://dartbug.com/32087: currently Kernel front-end
1361
- // embeds absolute build-time paths to core library sources into Kernel
1362
- // binaries this introduces discrepancy between how stack traces were
1363
- // looked like in legacy pipeline and how they look in Dart 2 pipeline and
1364
- // breaks users' code that attempts to pattern match and filter various
1365
- // irrelevant frames (e.g. frames from dart:async).
1366
- // This also breaks debugging experience in external debuggers because
1367
- // debugger attempts to open files that don't exist in the local file
1368
- // system.
1369
- // To work around this issue we reformat urls of scripts belonging to
1370
- // dart:-scheme libraries to look like they looked like in legacy pipeline:
1371
- //
1372
- // dart:libname/filename.dart
1373
- // dart:libname/runtime/lib/filename.dart
1374
- // dart:libname/runtime/bin/filename.dart
1375
- //
1376
- void KernelLoader::FixCoreLibraryScriptUri (const Library& library,
1377
- const Script& script) {
1378
- struct Helper {
1379
- static bool EndsWithCString (const String& haystack,
1380
- const char * needle,
1381
- intptr_t needle_length,
1382
- intptr_t end_pos) {
1383
- const intptr_t start = end_pos - needle_length + 1 ;
1384
- if (start >= 0 ) {
1385
- for (intptr_t i = 0 ; i < needle_length; i++) {
1386
- if (haystack.CharAt (start + i) != needle[i]) {
1387
- return false ;
1388
- }
1389
- }
1390
- return true ;
1391
- }
1392
- return false ;
1393
- }
1394
- };
1395
-
1396
- if (library.is_dart_scheme ()) {
1397
- String& url = String::Handle (zone_, script.url ());
1398
- if (!url.StartsWith (Symbols::DartScheme ())) {
1399
- // Search backwards until '/' is found. That gives us the filename.
1400
- // Note: can't use reusable handle in the code below because
1401
- // concat also needs it.
1402
- intptr_t pos = url.Length () - 1 ;
1403
- while (pos >= 0 && url.CharAt (pos) != ' /' ) {
1404
- pos--;
1405
- }
1406
-
1407
- static const char * kRuntimeLib = " runtime/lib/" ;
1408
- static const intptr_t kRuntimeLibLen = strlen (kRuntimeLib );
1409
- const bool inside_runtime_lib =
1410
- Helper::EndsWithCString (url, kRuntimeLib , kRuntimeLibLen , pos);
1411
-
1412
- static const char * kRuntimeBin = " runtime/bin/" ;
1413
- static const intptr_t kRuntimeBinLen = strlen (kRuntimeBin );
1414
- const bool inside_runtime_bin =
1415
- Helper::EndsWithCString (url, kRuntimeBin , kRuntimeBinLen , pos);
1416
-
1417
- String& tmp = String::Handle (zone_);
1418
- url = String::SubString (url, pos + 1 );
1419
- if (inside_runtime_lib) {
1420
- tmp = String::New (kRuntimeLib , Heap::kNew );
1421
- url = String::Concat (tmp, url);
1422
- } else if (inside_runtime_bin) {
1423
- tmp = String::New (kRuntimeBin , Heap::kNew );
1424
- url = String::Concat (tmp, url);
1425
- }
1426
- tmp = library.url ();
1427
- url = String::Concat (Symbols::Slash (), url);
1428
- url = String::Concat (tmp, url);
1429
- script.set_url (url);
1430
- }
1431
- }
1432
- }
1433
-
1434
1358
void KernelLoader::LoadClass (const Library& library,
1435
1359
const Class& toplevel_class,
1436
1360
intptr_t class_end,
@@ -1452,7 +1376,6 @@ void KernelLoader::LoadClass(const Library& library,
1452
1376
const Script& script =
1453
1377
Script::Handle (Z, ScriptAt (class_helper.source_uri_index_ ));
1454
1378
out_class->set_script (script);
1455
- FixCoreLibraryScriptUri (library, script);
1456
1379
}
1457
1380
if (out_class->token_pos () == TokenPosition::kNoSource ) {
1458
1381
class_helper.ReadUntilIncluding (ClassHelper::kStartPosition );
@@ -2011,7 +1934,6 @@ const Object& KernelLoader::ClassForScriptAt(const Class& klass,
2011
1934
patch_class ^= patch_classes_.At (source_uri_index);
2012
1935
if (patch_class.IsNull () || patch_class.origin_class () != klass.raw ()) {
2013
1936
ASSERT (!library_kernel_data_.IsNull ());
2014
- FixCoreLibraryScriptUri (Library::Handle (klass.library ()), correct_script);
2015
1937
patch_class = PatchClass::New (klass, correct_script);
2016
1938
patch_class.set_library_kernel_data (library_kernel_data_);
2017
1939
patch_class.set_library_kernel_offset (library_kernel_offset_);
@@ -2078,20 +2000,6 @@ RawScript* KernelLoader::LoadScriptAt(intptr_t index,
2078
2000
return script.raw ();
2079
2001
}
2080
2002
2081
- RawScript* KernelLoader::ScriptAt (intptr_t index,
2082
- const Library& library,
2083
- StringIndex import_uri) {
2084
- ASSERT (!library.IsNull ());
2085
- const Script& script =
2086
- Script::Handle (Z, kernel_program_info_.ScriptAt (index ));
2087
- if (library.is_dart_scheme ()) {
2088
- FixCoreLibraryScriptUri (library, script);
2089
- } else if (import_uri != -1 ) {
2090
- script.set_url (H.DartString (import_uri, Heap::kOld ));
2091
- }
2092
- return script.raw ();
2093
- }
2094
-
2095
2003
void KernelLoader::GenerateFieldAccessors (const Class& klass,
2096
2004
const Field& field,
2097
2005
FieldHelper* field_helper) {
0 commit comments