diff --git a/pkg/dev_compiler/lib/src/options.dart b/pkg/dev_compiler/lib/src/options.dart index 1fa1a0f3547..d4fb08610b3 100644 --- a/pkg/dev_compiler/lib/src/options.dart +++ b/pkg/dev_compiler/lib/src/options.dart @@ -13,6 +13,7 @@ import 'package:logging/logging.dart' show Level; import 'package:path/path.dart' as path; import 'package:yaml/yaml.dart'; +const String _V8_BINARY_DEFAULT = 'node'; const bool _CLOSURE_DEFAULT = false; /// Options used to set up Source URI resolution in the analysis context. @@ -87,7 +88,7 @@ class RunnerOptions { /// executable. final String v8Binary; - const RunnerOptions({this.v8Binary: 'iojs'}); + const RunnerOptions({this.v8Binary: _V8_BINARY_DEFAULT}); } /// General options used by the dev compiler and server. @@ -206,7 +207,7 @@ CompilerOptions parseOptions(List argv, {bool forceOutDir: false}) { var htmlReport = args['html-report']; var v8Binary = args['v8-binary']; - if (v8Binary == null) v8Binary = 'iojs'; + if (v8Binary == null) v8Binary = _V8_BINARY_DEFAULT; var customUrlMappings = {}; for (var mapping in args['url-mapping']) { @@ -321,12 +322,20 @@ final ArgParser argParser = new ArgParser() help: 'Output compilation results to html', defaultsTo: false) ..addOption('v8-binary', help: 'V8-based binary to run JavaScript output with (iojs, node, d8)', - defaultsTo: 'iojs') + defaultsTo: _V8_BINARY_DEFAULT) ..addOption('dump-info-file', help: 'Dump info json file (requires dump-info)', defaultsTo: null); // TODO: Switch over to the `pub_cache` package (or the Resource API)? +const _ENTRY_POINTS = const [ + 'dartdevc.dart', + 'dev_compiler.dart', + 'devrun.dart' +]; + +final _ENTRY_POINT_SNAPSHOTS = _ENTRY_POINTS.map((f) => "$f.snapshot"); + /// Tries to find the `lib/runtime/` directory of the dev_compiler package. This /// works when running devc from it's sources or from a snapshot that is /// activated via `pub global activate`. @@ -346,16 +355,13 @@ String _computeRuntimeDir() { if (!new File(lockfile).existsSync()) return null; // If running from sources we found it! - if (file == 'dartdevc.dart' || - file == 'dev_compiler.dart' || - file == 'devrun.dart') { + if (_ENTRY_POINTS.contains(file)) { return path.join(dir, 'lib', 'runtime'); } // If running from a pub global snapshot, we need to read the lock file to // find where the actual sources are located in the pub cache. - if (file == 'dartdevc.dart.snapshot' || - file == 'dev_compiler.dart.snapshot') { + if (_ENTRY_POINT_SNAPSHOTS.contains(file)) { // Note: this depends on implementation details of pub. var yaml = loadYaml(new File(lockfile).readAsStringSync()); var info = yaml['packages']['dev_compiler']; diff --git a/pkg/dev_compiler/lib/src/runner/v8_runner.dart b/pkg/dev_compiler/lib/src/runner/v8_runner.dart index 079606fa57a..704d4b33ada 100644 --- a/pkg/dev_compiler/lib/src/runner/v8_runner.dart +++ b/pkg/dev_compiler/lib/src/runner/v8_runner.dart @@ -17,8 +17,7 @@ import 'runtime_utils.dart' show getRuntimeFileAlias; _parseV8Version(String version) => new Version.parse(version.split('.').getRange(0, 3).join('.')); -/// io.js still has issues, like lexical this in arrow functions. -final _MIN_SUPPORTED_V8_VERSION = _parseV8Version("4.4.63"); +final _MIN_SUPPORTED_V8_VERSION = _parseV8Version("4.5.103.30"); /// TODO(ochafik): Move to dart_library.js const _GLOBALS = r''' @@ -52,15 +51,8 @@ abstract class V8Runner { Future start(List files, String startStatement) => Process.start( - _v8Binary, - [ - "--harmony_arrow_functions", - "--harmony_classes", - "--harmony_computed_property_names", - "--harmony_generators", - "--harmony_object_literals", - "--harmony_rest_parameters", - "--harmony_spreadcalls", + _v8Binary, [ + "--harmony", "-e", _GLOBALS + _getLoadStatements(files).join() + startStatement ],