Repository: flutter
Issue: Hot reload fails with error: Unexpected tag 74 (ReturnStatement)
Labels: tool,dependency: dart,t: hot reload,P2,team-tool,triaged-tool

## Steps to Reproduce

I'm running `/Users/scheglov/Source/flutter/bin/flutter --no-color, run, --machine, --track-widget-creation, --device-id=flutter-tester, /Users/scheglov/dart/flutter-projects/test_sink/.dart_tool/render_server.dart` and hot reload fails with the error below when I change `render_server.dart`

  The file `render_server.dart` imports `to_render.dart`.
  If I make small changes to `to_render.dart`, like changing a string literal, hot reload works fine.
  But when I make a big change, like replacing the file with completely different class, it fails.

## Logs

Run your application with `flutter run` and attach all the log output.
```
[{"event":"app.progress","params":{"appId":"19f86ad7-9e8d-4f7e-824c-3d55cc5eaa9a","id":"12","progressId":"hot.reload","message":"Performing hot reload..."}}]

{"exception":"'file:///Users/scheglov/dart/flutter-projects/test_sink/.dart_tool/to_render.dart': error: Unexpected tag 74 (ReturnStatement) in MyHomePage.build, expected a procedure, a constructor or a function node","stackTrace":"#0      StatelessElement.build (package:flutter/src/widgets/framework.dart:3687:28)\n#1      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3634:15)\n#2      Element.rebuild (package:flutter/src/widgets/framework.dart:3487:5)\n#3      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2234:33)\n#4      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:626:20)\n#5      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)\n#6      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)\n#7      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)\n#8      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:751:7)\n#9      Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)\n#10     _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)\n#11     _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)\n#12     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)\n","library":"widgets library","context":"building MyHomePage(dirty)"}
```
Or (without `--track-widget-creation`):

```
[{"event":"app.progress","params":{"appId":"89a2baf5-fbd5-454e-91ef-7172d5f37009","id":"1","progressId":"hot.reload","message":"Initializing hot reload..."}}]

{"exception":"'file:///Users/scheglov/dart/flutter-projects/test_sink/.dart_tool/to_render.dart': error: Unexpected tag 128 (SpecializedVariableGet) in MyHomePage.build, expected a procedure, a constructor or a function node","stackTrace":"#0      StatelessElement.build (package:flutter/src/widgets/framework.dart:3687:28)\n#1      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3634:15)\n#2      Element.rebuild (package:flutter/src/widgets/framework.dart:3487:5)\n#3      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2234:33)\n#4      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:626:20)\n#5      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)\n#6      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)\n#7      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)\n#8      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:751:7)\n#9      Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)\n#10     _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)\n#11     _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)\n#12     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)\n","library":"widgets library","context":"building MyHomePage(dirty)"}
```


Run `flutter analyze` and attach any output of that command also.

## Flutter Doctor

Paste the output of running `flutter doctor -v` here.
```
Flutter 0.3.6-pre.86 • channel master • git@github.com:scheglov/flutter.git
Framework • revision dba7855de8 (10 minutes ago) • 2018-05-02 11:18:48 -0700
Engine • revision d48ba4c034
Tools • Dart 2.0.0-dev.50.0.flutter-0cc70c4a7c

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v0.3.6-pre.86, on Mac OS X 10.13.3 17D47, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.2)
[!] iOS toolchain - develop for iOS devices (Xcode 9.2)
    ✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew install ios-deploy
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To install:
        brew install cocoapods
        pod setup
[✓] Android Studio (version 3.0)
[!] IntelliJ IDEA Ultimate Edition (version 2018.1)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Community Edition (version 2018.1)
[!] VS Code (version 1.10.1)
[!] Connected devices
    ! No devices available

! Doctor found issues in 4 categories.
```

> For more information about diagnosing and reporting Flutter bugs, please see [https://flutter.io/bug-reports/](https://flutter.io/bug-reports/).