Merge pull request #2 from dart-lang/object_workaround

use Object instead of dynamic to workaround analyzer const bug
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b85bde7..144ef29 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+#### 0.3.2
+  * Work around an issue running Dart analyzer on the generated code, if the
+    `dynamic` type appeared in the output. Smoke will now use `Object` instead.
+
 #### 0.3.1+1
   * Updated dependency versions.
 
diff --git a/lib/codegen/generator.dart b/lib/codegen/generator.dart
index efacaea..a332db8 100644
--- a/lib/codegen/generator.dart
+++ b/lib/codegen/generator.dart
@@ -384,7 +384,12 @@
 
   List<String> get librariesUsed => [importUrl];
   String asCode(Map<String, String> libraryPrefixes) {
-    if (importUrl == 'dart:core' || importUrl == null) return name;
+    if (importUrl == 'dart:core' || importUrl == null) {
+      // TODO(jmesserly): analyzer doesn't consider `dynamic` to be a constant,
+      // so use Object as a workaround:
+      // https://code.google.com/p/dart/issues/detail?id=22989
+      return name == 'dynamic' ? 'Object' : name;
+    }
     return '${libraryPrefixes[importUrl]}.$name';
   }
 
diff --git a/pubspec.yaml b/pubspec.yaml
index a4d1331..2369a05 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: smoke
-version: 0.3.1+1
+version: 0.3.2
 author: Polymer.dart Authors <web-ui-dev@dartlang.org>
 homepage: https://github.com/dart-lang/smoke
 description: >
diff --git a/test/codegen/recorder_test.dart b/test/codegen/recorder_test.dart
index 2a9fab9..cc6d54a 100644
--- a/test/codegen/recorder_test.dart
+++ b/test/codegen/recorder_test.dart
@@ -203,8 +203,8 @@
           '    checkedMode: false,\n'
           '    declarations: {\n'
           '      smoke_0.I: {\n'
-          '        #i1: const Declaration(#i1, dynamic),\n'
-          '        #i2: const Declaration(#i2, dynamic, kind: PROPERTY),\n'
+          '        #i1: const Declaration(#i1, Object),\n'
+          '        #i2: const Declaration(#i2, Object, kind: PROPERTY),\n'
           '      },\n'
           '    }));\n');
     });
@@ -538,8 +538,8 @@
           '    },\n'
           '    declarations: {\n'
           '      smoke_0.I: {\n'
-          '        #i1: const Declaration(#i1, dynamic),\n'
-          '        #i2: const Declaration(#i2, dynamic, kind: PROPERTY),\n'
+          '        #i1: const Declaration(#i1, Object),\n'
+          '        #i2: const Declaration(#i2, Object, kind: PROPERTY),\n'
           '        #i3: const Declaration(#i3, smoke_0.G, kind: PROPERTY, '
           'isFinal: true),\n'
           '        #m4: const Declaration(#m4, Function, kind: METHOD),\n'