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

Side by Side Diff: runtime/bin/builtin.dart

Issue 36883005: Add fields to platform library, implement them on runtime dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase on CL 32683002 Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/dartutils.h » ('j') | sdk/lib/platform/platform.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/dartutils.h » ('j') | sdk/lib/platform/platform.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698