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

Side by Side Diff: tools/patch_sdk.dart

Issue 2571563005: Turn the VM's dart:typed_data into a patch (Closed)
Patch Set: Fix interface/implementation type mismatch Created 4 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/vm.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 /// Command line tool to merge the SDK libraries and our patch files. 6 /// Command line tool to merge the SDK libraries and our patch files.
7 /// This is currently designed as an offline tool, but we could automate it. 7 /// This is currently designed as an offline tool, but we could automate it.
8 8
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:math' as math; 10 import 'dart:math' as math;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 for (SdkLibrary library in sdkLibraries) { 103 for (SdkLibrary library in sdkLibraries) {
104 // TODO(jmesserly): analyzer does not handle the default case of 104 // TODO(jmesserly): analyzer does not handle the default case of
105 // "both platforms" correctly, and treats it as being supported on neither. 105 // "both platforms" correctly, and treats it as being supported on neither.
106 // So instead we skip explicitly marked as either VM or dart2js libs. 106 // So instead we skip explicitly marked as either VM or dart2js libs.
107 if (mode == 'ddc' ? libary.isVmLibrary : library.isDart2JsLibrary) { 107 if (mode == 'ddc' ? libary.isVmLibrary : library.isDart2JsLibrary) {
108 continue; 108 continue;
109 } 109 }
110 110
111 var libraryOut = path.join(sdkLibIn, library.path); 111 var libraryOut = path.join(sdkLibIn, library.path);
112 var libraryIn; 112 var libraryIn;
113 if (mode == 'vm' && library.path.contains('typed_data.dart')) { 113 if (mode == 'ddc' && library.path.contains(INTERNAL_PATH)) {
114 // dart:typed_data is unlike the other libraries in the SDK. The VM does
115 // not apply a patch to the base SDK implementation of the library.
116 // Instead, the VM provides a replacement implementation and ignores the
117 // sources in the SDK.
118 libraryIn =
119 path.join(dartDir, 'runtime', 'lib', 'typed_data.dart');
120 } else if (mode == 'ddc' && library.path.contains(INTERNAL_PATH)) {
121 libraryIn = 114 libraryIn =
122 path.join(privateIn, library.path.replaceAll(INTERNAL_PATH, '')); 115 path.join(privateIn, library.path.replaceAll(INTERNAL_PATH, ''));
123 } else { 116 } else {
124 libraryIn = libraryOut; 117 libraryIn = libraryOut;
125 } 118 }
126 119
127 var libraryFile = new File(libraryIn); 120 var libraryFile = new File(libraryIn);
128 if (libraryFile.existsSync()) { 121 if (libraryFile.existsSync()) {
129 var outPaths = <String>[libraryOut]; 122 var outPaths = <String>[libraryOut];
130 var libraryContents = libraryFile.readAsStringSync(); 123 var libraryContents = libraryFile.readAsStringSync();
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 if (diff != 0) return diff; 520 if (diff != 0) return diff;
528 return end - other.end; 521 return end - other.end;
529 } 522 }
530 } 523 }
531 524
532 List<SdkLibrary> _getSdkLibraries(String contents) { 525 List<SdkLibrary> _getSdkLibraries(String contents) {
533 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); 526 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true);
534 parseCompilationUnit(contents).accept(libraryBuilder); 527 parseCompilationUnit(contents).accept(libraryBuilder);
535 return libraryBuilder.librariesMap.sdkLibraries; 528 return libraryBuilder.librariesMap.sdkLibraries;
536 } 529 }
OLDNEW
« no previous file with comments | « runtime/vm/vm.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698