Fixes issue #1823; adds a gwt_version global var to record the GWT version.

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1512 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/GWTCompiler.java b/dev/core/src/com/google/gwt/dev/GWTCompiler.java
index 4e0fceb..f9610d4 100644
--- a/dev/core/src/com/google/gwt/dev/GWTCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/GWTCompiler.java
@@ -463,6 +463,8 @@
     //
     out.print("<head><script>");
     out.newlineOpt();
+    out.print("var $gwt_version = \"" + About.GWT_VERSION_NUM + "\";");
+    out.newlineOpt();
     out.print("var $wnd = parent;");
     out.newlineOpt();
     out.print("var $doc = $wnd.document;");
@@ -504,6 +506,8 @@
 
     // Setup the well-known variables.
     //
+    out.print("var $gwt_version = \"" + About.GWT_VERSION_NUM + "\";");
+    out.newlineOpt();
     out.print("var $wnd = window;");
     out.newlineOpt();
     out.print("var $doc = $wnd.document;");
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java b/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java
index 20f52d0..d2d4d36 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsRootScope.java
@@ -47,7 +47,7 @@
         "Error", "Function", "Global", "Image", "Math", "Number", "Object",
         "RegExp", "String", "VBArray", "window", "document", "event",
         "arguments", "call", "toString", "$wnd", "$doc", "$moduleName",
-        "$moduleBase", "undefined", "getClass"};
+        "$moduleBase", "undefined", "getClass", "$gwt_version"};
 
     for (int i = 0; i < commonBuiltins.length; i++) {
       String ident = commonBuiltins[i];