| OLD | NEW |
| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 if (needsUpdate) { | 175 if (needsUpdate) { |
| 176 var contents = <String>[libraryContents]; | 176 var contents = <String>[libraryContents]; |
| 177 contents.addAll(partFiles.map((f) => f.readAsStringSync())); | 177 contents.addAll(partFiles.map((f) => f.readAsStringSync())); |
| 178 if (patchExists) { | 178 if (patchExists) { |
| 179 var patchContents = patchFile.readAsStringSync(); | 179 var patchContents = patchFile.readAsStringSync(); |
| 180 contents = _patchLibrary( | 180 contents = _patchLibrary( |
| 181 patchFile.path, contents, patchContents); | 181 patchFile.path, contents, patchContents); |
| 182 } | 182 } |
| 183 | 183 |
| 184 for (var i = 0; i < outPaths.length; i++) { | 184 for (var i = 0; i < outPaths.length; i++) { |
| 185 if (path.basename(outPaths[i]) == 'internal.dart') { | |
| 186 contents[i] += ''' | |
| 187 | |
| 188 /// Marks a function as an external implementation ("native" in the Dart VM). | |
| 189 /// | |
| 190 /// Provides a backend-specific String that can be used to identify the | |
| 191 /// function's implementation | |
| 192 class ExternalName { | |
| 193 final String name; | |
| 194 const ExternalName(this.name); | |
| 195 } | |
| 196 '''; | |
| 197 } | |
| 198 | |
| 199 _writeSync(outPaths[i], contents[i]); | 185 _writeSync(outPaths[i], contents[i]); |
| 200 } | 186 } |
| 201 } | 187 } |
| 202 } | 188 } |
| 203 } | 189 } |
| 204 if (mode == 'vm') { | 190 if (mode == 'vm') { |
| 205 | 191 |
| 206 for (var tuple in [['_builtin', 'builtin.dart']]) { | 192 for (var tuple in [['_builtin', 'builtin.dart']]) { |
| 207 var vmLibrary = tuple[0]; | 193 var vmLibrary = tuple[0]; |
| 208 var dartFile = tuple[1]; | 194 var dartFile = tuple[1]; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 if (diff != 0) return diff; | 527 if (diff != 0) return diff; |
| 542 return end - other.end; | 528 return end - other.end; |
| 543 } | 529 } |
| 544 } | 530 } |
| 545 | 531 |
| 546 List<SdkLibrary> _getSdkLibraries(String contents) { | 532 List<SdkLibrary> _getSdkLibraries(String contents) { |
| 547 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); | 533 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); |
| 548 parseCompilationUnit(contents).accept(libraryBuilder); | 534 parseCompilationUnit(contents).accept(libraryBuilder); |
| 549 return libraryBuilder.librariesMap.sdkLibraries; | 535 return libraryBuilder.librariesMap.sdkLibraries; |
| 550 } | 536 } |
| OLD | NEW |