@@ -618,7 +618,6 @@ bool Options::ParseArguments(int argc,
618618 // The arguments to the VM are at positions 1 through i-1 in argv.
619619 Platform::SetExecutableArguments (i, argv);
620620
621- bool implicitly_use_dart_dev = false ;
622621 bool run_script = false ;
623622 // Get the script name.
624623 if (i < argc) {
@@ -632,8 +631,7 @@ bool Options::ParseArguments(int argc,
632631 bool is_potential_file_path = true ;
633632#endif // !defined(DART_PRECOMPILED_RUNTIME)
634633 if (Options::disable_dart_dev () ||
635- (Options::snapshot_filename () != nullptr ) ||
636- (is_potential_file_path && !enable_vm_service_)) {
634+ (Options::snapshot_filename () != nullptr ) || is_potential_file_path) {
637635 *script_name = Utils::StrDup (argv[i]);
638636 run_script = true ;
639637 i++;
@@ -642,15 +640,6 @@ bool Options::ParseArguments(int argc,
642640 else { // NOLINT
643641 DartDevIsolate::set_should_run_dart_dev (true );
644642 }
645- if (!Options::disable_dart_dev () && enable_vm_service_) {
646- // Handle the special case where the user is running a Dart program
647- // without using a DartDev command and wants to use the VM service. Here
648- // we'll run the program using DartDev as it's used to spawn a DDS
649- // instance.
650- if (is_potential_file_path) {
651- implicitly_use_dart_dev = true ;
652- }
653- }
654643#endif // !defined(DART_PRECOMPILED_RUNTIME)
655644 }
656645#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -714,13 +703,8 @@ bool Options::ParseArguments(int argc,
714703 // If running with dartdev, attempt to parse VM flags which are part of the
715704 // dartdev command (e.g., --enable-vm-service, --observe, etc).
716705 if (!run_script) {
717- int tmp_i = i;
718- // We only run the CLI implicitly if the service is enabled and the user
719- // didn't run with the 'run' command. If they did provide a command, we need
720- // to skip it here to continue parsing VM flags.
721- if (!implicitly_use_dart_dev) {
722- tmp_i++;
723- }
706+ // Skip the command.
707+ int tmp_i = i + 1 ;
724708 while (tmp_i < argc) {
725709 // Check if this flag is a potentially valid VM flag. If not, we've likely
726710 // hit a script name and are done parsing VM flags.
@@ -742,30 +726,19 @@ bool Options::ParseArguments(int argc,
742726 bool first_option = true ;
743727 // Parse out options to be passed to dart main.
744728 while (i < argc) {
745- if (implicitly_use_dart_dev && first_option) {
746- // Special case where user enables VM service without using a dartdev
747- // run command. If 'run' is provided, it will be the first argument
748- // processed in this loop.
749- dart_options->AddArgument (" run" );
750- } else {
751- // dart run isn't able to parse these options properly. Since it doesn't
752- // need to use the values from these options, just strip them from the
753- // argument list passed to dart run.
754- if (!IsOption (argv[i], " observe" ) &&
755- !IsOption (argv[i], " enable-vm-service" )) {
756- dart_options->AddArgument (argv[i]);
757- }
758- i++;
729+ // dart run isn't able to parse these options properly. Since it doesn't
730+ // need to use the values from these options, just strip them from the
731+ // argument list passed to dart run.
732+ if (!IsOption (argv[i], " observe" ) &&
733+ !IsOption (argv[i], " enable-vm-service" )) {
734+ dart_options->AddArgument (argv[i]);
759735 }
736+ i++;
760737 // Add DDS specific flags immediately after the dartdev command.
761738 if (first_option) {
762739 // DDS is only enabled for the run command. Make sure we don't pass DDS
763740 // specific flags along with other commands, otherwise argument parsing
764741 // will fail unexpectedly.
765- bool run_command = implicitly_use_dart_dev;
766- if (!run_command && strcmp (argv[i - 1 ], " run" ) == 0 ) {
767- run_command = true ;
768- }
769742#if !defined(DART_PRECOMPILED_RUNTIME)
770743 // Bring any --packages option into the dartdev command
771744 if (DartDevIsolate::should_run_dart_dev () &&
0 commit comments