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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * The Options object allows accessing the arguments which have been passed to | 8 * The Options object allows accessing the arguments which have been passed to |
9 * the current isolate. | 9 * the current isolate. |
10 */ | 10 */ |
(...skipping 26 matching lines...) Expand all Loading... |
37 /** | 37 /** |
38 * Returns the path of the script being run in this isolate. | 38 * Returns the path of the script being run in this isolate. |
39 * | 39 * |
40 * If the executable environment does not support [script] an empty | 40 * If the executable environment does not support [script] an empty |
41 * string is returned. | 41 * string is returned. |
42 */ | 42 */ |
43 String get script; | 43 String get script; |
44 | 44 |
45 | 45 |
46 /** | 46 /** |
47 * Returns the version of the current dart runtime. | 47 * Returns the version of the current Dart runtime. |
48 */ | 48 */ |
49 String get version; | 49 String get version; |
50 } | 50 } |
51 | 51 |
52 class _OptionsImpl implements Options { | 52 class _OptionsImpl implements Options { |
| 53 List<String> _arguments = null; |
| 54 |
| 55 // This arguments singleton is written to by the embedder if applicable. |
| 56 static List<String> _nativeArguments = const []; |
| 57 |
53 List<String> get arguments { | 58 List<String> get arguments { |
54 if (_arguments == null) { | 59 if (_arguments == null) { |
55 // On first access make a copy of the native arguments. | 60 // On first access make a copy of the native arguments. |
56 _arguments = _nativeArguments.sublist(0, _nativeArguments.length); | 61 _arguments = _nativeArguments.sublist(0, _nativeArguments.length); |
57 } | 62 } |
58 return _arguments; | 63 return _arguments; |
59 } | 64 } |
60 | 65 |
61 String get executable { | 66 String get executable => Platform.executable; |
62 return _nativeExecutable; | 67 String get script => Platform.script; |
63 } | 68 String get version => Platform.version; |
64 | |
65 String get script { | |
66 return _nativeScript; | |
67 } | |
68 | |
69 external String get version; | |
70 | |
71 List<String> _arguments = null; | |
72 | |
73 // This arguments singleton is written to by the embedder if applicable. | |
74 static List<String> _nativeArguments = const []; | |
75 | |
76 // This executable singleton is written to by the embedder if applicable. | |
77 static String _nativeExecutable = ''; | |
78 | |
79 // This script singleton is written to by the embedder if applicable. | |
80 static String _nativeScript = ''; | |
81 } | 69 } |
OLD | NEW |