| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library builtin; | 5 library builtin; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 // Corelib 'print' implementation. | 8 // Corelib 'print' implementation. |
| 9 void _print(arg) { | 9 void _print(arg) { |
| 10 _Logger._printString(arg.toString()); | 10 _Logger._printString(arg.toString()); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 303 } |
| 304 _logResolution('# Package: $uri -> $path'); | 304 _logResolution('# Package: $uri -> $path'); |
| 305 return path; | 305 return path; |
| 306 } | 306 } |
| 307 | 307 |
| 308 | 308 |
| 309 String _filePathFromHttpUri(Uri uri) { | 309 String _filePathFromHttpUri(Uri uri) { |
| 310 _logResolution('# Path: $uri -> $uri'); | 310 _logResolution('# Path: $uri -> $uri'); |
| 311 return uri.toString(); | 311 return uri.toString(); |
| 312 } | 312 } |
| 313 |
| 314 |
| 315 // platform library '_platform' implementation. |
| 316 _platform(int propertyIndex) { |
| 317 const int kNumberOfProcessors = 1; |
| 318 const int kPathSeparator = 2; |
| 319 const int kOperatingSystem = 3; |
| 320 const int kLocalHostname = 4; |
| 321 const int kVersion = 5; |
| 322 const int kEnvironment = 6; |
| 323 const int kScript = 7; |
| 324 const int kExecutable = 8; |
| 325 const int kExecutableArguments = 9; |
| 326 const int kPackageRoot = 10; |
| 327 switch (propertyIndex) { |
| 328 case kNumberOfProcessors: |
| 329 return Platform.numberOfProcessors; |
| 330 break; |
| 331 case kPathSeparator: |
| 332 return Platform.pathSeparator; |
| 333 break; |
| 334 case kOperatingSystem: |
| 335 return Platform.operatingSystem; |
| 336 break; |
| 337 case kLocalHostname: |
| 338 return Platform.localHostname; |
| 339 break; |
| 340 case kVersion: |
| 341 return Platform.version; |
| 342 break; |
| 343 case kEnvironment: |
| 344 return Platform.environment; |
| 345 break; |
| 346 case kScript: |
| 347 return Platform.script; |
| 348 break; |
| 349 case kExecutable: |
| 350 return Platform.executable; |
| 351 break; |
| 352 case kExecutableArguments: |
| 353 return Platform.executableArguments; |
| 354 break; |
| 355 case kPackageRoot: |
| 356 return Platform.packageRoot; |
| 357 break; |
| 358 default: |
| 359 throw new UnimplementedError( |
| 360 "Unknown property $propertyIndex of platform"); |
| 361 break; |
| 362 } |
| 363 } |
| 364 |
| 365 _getPlatform() => _platform; |
| 366 |
| 367 |
| 368 |
| OLD | NEW |