Update trunk to version 0.4.6.1
svn merge -r 21363:21386 https://dart.googlecode.com/svn/branches/bleeding_edge trunk

--This line, and thsss below, will be ignored--

_M   .
_M   dart
M    dart/editor/tools/plugins/com.google.dart.tools.deploy/themes/default.xml
M    dart/editor/tools/plugins/com.google.dart.tools.deploy/themes/dartboard.xml
M    dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/SimpleParserTest.java
M    dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java
M    dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java
M    dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
M    dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/ResolverTestCase.java
A  + dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/TypePropagationTest.java
M    dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/resolver/TestAll.java
A  + dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/resolver/TypeOverrideManagerTest.java
M    dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/resolver/StaticTypeAnalyzerTest.java
A  + dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/timing/SDKAnalysisTest.java
M    dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
M    dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/element/member/ParameterMember.java
A  + dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/element/member/FieldMember.java
A  + dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/element/member/VariableMember.java
M    dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/element/member/PropertyAccessorMember.java
M    dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/LibraryResolver.java
M    dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
A  + dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/TypeOverrideManager.java
M    dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/StaticTypeAnalyzer.java
M    dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ResolverVisitor.java
M    dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/TypeResolverVisitor.java
M    dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/scanner/AbstractScanner.java
M    dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/StaticTypeWarningCode.java
M    dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/webkit/WebkitConnection.java
M    dart/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/analysis/model/ProjectImplTest.java
M    dart/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/generator/GeneratorUtils.java
M    dart/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/analysis/model/ProjectImpl.java
M    dart/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/pub/PubBuildParticipant.java
M    dart/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
M    dart/tools/VERSION
M    dart/tools/dom/scripts/fremontcutbuilder.py
M    dart/tests/language/if_conversion_vm_test.dart
M    dart/tests/language/language_dart2js.status
M    dart/tests/language/language.status
M    dart/tests/language/rethrow_test.dart
M    dart/samples/third_party/todomvc/pubspec.yaml
M    dart/samples/third_party/todomvc/web/todo_row.html
M    dart/samples/third_party/todomvc/web/model.dart
M    dart/samples/third_party/todomvc/web/editable_label.html
M    dart/pkg/analyzer_experimental/lib/src/generated/java_core.dart
M    dart/pkg/pkg.status
M    dart/runtime/vm/os_win.cc
M    dart/runtime/vm/simulator_mips.cc
M    dart/runtime/vm/isolate.cc
M    dart/runtime/vm/intrinsifier_x64.cc
M    dart/runtime/vm/intrinsifier.h
M    dart/runtime/vm/assembler_mips.h
M    dart/runtime/vm/intrinsifier_ia32.cc
M    dart/runtime/vm/parser.cc
M    dart/runtime/vm/assembler_mips_test.cc
M    dart/runtime/vm/constants_mips.h
M    dart/runtime/vm/intermediate_language_x64.cc
M    dart/runtime/vm/os_linux.cc
M    dart/runtime/vm/object.h
M    dart/runtime/vm/code_generator.cc
M    dart/runtime/vm/token.h
M    dart/runtime/vm/object.cc
M    dart/runtime/vm/flow_graph_builder.cc
M    dart/runtime/vm/simulator_mips.h
M    dart/runtime/vm/disassembler_mips.cc
M    dart/runtime/vm/os.h
M    dart/runtime/vm/os_macos.cc
M    dart/runtime/vm/intermediate_language.h
M    dart/runtime/vm/intermediate_language_ia32.cc
M    dart/runtime/vm/os_android.cc
M    dart/runtime/platform/globals.h

git-svn-id: http://dart.googlecode.com/svn/trunk@21388 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/lib/compiler/implementation/lib/web.dart b/lib/compiler/implementation/lib/web.dart
new file mode 100644
index 0000000..a75db7b
--- /dev/null
+++ b/lib/compiler/implementation/lib/web.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#library("web");
+
+String htmlEscape(String text) {
+  throw "Unimplemented: web::htmlEscape(String).";
+}
diff --git a/lib/compiler/implementation/lib/web.dartp b/lib/compiler/implementation/lib/web.dartp
new file mode 100644
index 0000000..c3ba2ad
--- /dev/null
+++ b/lib/compiler/implementation/lib/web.dartp
@@ -0,0 +1,13 @@
+// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Patch file for dart:web
+
+/*patch*/ String htmlEscape(String text) {
+  return text.replaceAll("&", "&")
+             .replaceAll("<", "&lt;")
+             .replaceAll(">", "&gt;")
+             .replaceAll('"', "&quot;")
+             .replaceAll("'", "&apos;");  // Different from original.
+}
diff --git a/lib/dom/templates/html/dartium/factoryprovider__Elements.darttemplate b/lib/dom/templates/html/dartium/factoryprovider__Elements.darttemplate
new file mode 100644
index 0000000..8fe27e5
--- /dev/null
+++ b/lib/dom/templates/html/dartium/factoryprovider__Elements.darttemplate
@@ -0,0 +1,7 @@
+// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class _Elements {
+
+$!FACTORY_METHODS}
diff --git a/lib/dom/templates/html/dartium/impl_EventTarget.darttemplate b/lib/dom/templates/html/dartium/impl_EventTarget.darttemplate
new file mode 100644
index 0000000..1b4a00d
--- /dev/null
+++ b/lib/dom/templates/html/dartium/impl_EventTarget.darttemplate
@@ -0,0 +1,106 @@
+// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class _EventsImpl implements Events {
+  // TODO(podivilov): add type.
+  final _ptr;
+
+  final Map<String, EventListenerList> _listenerMap;
+
+  _EventsImpl(this._ptr) : _listenerMap = <EventListenerList>{};
+
+  EventListenerList operator [](String type) {
+    return _listenerMap.putIfAbsent(type,
+      () => new _EventListenerListImpl(_ptr, type));
+  }
+}
+
+class _EventListenerWrapper {
+  final EventListener raw;
+  final Function wrapped;
+  final bool useCapture;
+  _EventListenerWrapper(this.raw, this.wrapped, this.useCapture);
+}
+
+class _EventListenerListImpl implements EventListenerList {
+  // TODO(podivilov): add type.
+  final _ptr;
+  final String _type;
+  List<_EventListenerWrapper> _wrappers;
+
+  _EventListenerListImpl(this._ptr, this._type) :
+    // TODO(jacobr): switch to <_EventListenerWrapper>[] when the VM allow it.
+    _wrappers = new List<_EventListenerWrapper>();
+
+  EventListenerList add(EventListener listener, [bool useCapture = false]) {
+    _add(listener, useCapture);
+    return this;
+  }
+
+  EventListenerList remove(EventListener listener, [bool useCapture = false]) {
+    _remove(listener, useCapture);
+    return this;
+  }
+
+  bool dispatch(Event evt) {
+    // TODO(jacobr): what is the correct behavior here. We could alternately
+    // force the event to have the expected type.
+    assert(evt.type == _type);
+    return _ptr.$dom_dispatchEvent(evt);
+  }
+
+  void _add(EventListener listener, bool useCapture) {
+    _ptr.$dom_addEventListener(_type,
+                          _findOrAddWrapper(listener, useCapture),
+                          useCapture);
+  }
+
+  void _remove(EventListener listener, bool useCapture) {
+    Function wrapper = _removeWrapper(listener, useCapture);
+    if (wrapper !== null) {
+      _ptr.$dom_removeEventListener(_type, wrapper, useCapture);
+    }
+  }
+
+  Function _removeWrapper(EventListener listener, bool useCapture) {
+    if (_wrappers === null) {
+      return null;
+    }
+    for (int i = 0; i < _wrappers.length; i++) {
+      _EventListenerWrapper wrapper = _wrappers[i];
+      if (wrapper.raw === listener && wrapper.useCapture == useCapture) {
+        // Order doesn't matter so we swap with the last element instead of
+        // performing a more expensive remove from the middle of the list.
+        if (i + 1 != _wrappers.length) {
+          _wrappers[i] = _wrappers.removeLast();
+        } else {
+          _wrappers.removeLast();
+        }
+        return wrapper.wrapped;
+      }
+    }
+    return null;
+  }
+
+  Function _findOrAddWrapper(EventListener listener, bool useCapture) {
+    if (_wrappers === null) {
+      _wrappers = <_EventListenerWrapper>[];
+    } else {
+      for (_EventListenerWrapper wrapper in _wrappers) {
+        if (wrapper.raw === listener && wrapper.useCapture == useCapture) {
+          return wrapper.wrapped;
+        }
+      }
+    }
+    final wrapped = (e) { listener(e); };
+    _wrappers.add(new _EventListenerWrapper(listener, wrapped, useCapture));
+    return wrapped;
+  }
+}
+
+class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
+/*
+$!MEMBERS
+*/
+}
diff --git a/lib/dom/templates/html/frog/factoryprovider__Elements.darttemplate b/lib/dom/templates/html/frog/factoryprovider__Elements.darttemplate
new file mode 100644
index 0000000..8fe27e5
--- /dev/null
+++ b/lib/dom/templates/html/frog/factoryprovider__Elements.darttemplate
@@ -0,0 +1,7 @@
+// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class _Elements {
+
+$!FACTORY_METHODS}
diff --git a/lib/dom/templates/html/frog/impl_EventTarget.darttemplate b/lib/dom/templates/html/frog/impl_EventTarget.darttemplate
new file mode 100644
index 0000000..893f3d2
--- /dev/null
+++ b/lib/dom/templates/html/frog/impl_EventTarget.darttemplate
@@ -0,0 +1,61 @@
+// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class _EventsImpl implements Events {
+  /* Raw event target. */
+  // TODO(jacobr): it would be nice if we could specify this as
+  // _EventTargetImpl or EventTarget
+  final Dynamic _ptr;
+
+  _EventsImpl(this._ptr);
+
+  _EventListenerListImpl operator [](String type) {
+    return new _EventListenerListImpl(_ptr, type);
+  }
+}
+
+class _EventListenerListImpl implements EventListenerList {
+  
+  // TODO(jacobr): make this _EventTargetImpl
+  final Dynamic _ptr;
+  final String _type;
+
+  _EventListenerListImpl(this._ptr, this._type);
+
+  // TODO(jacobr): implement equals.
+
+  _EventListenerListImpl add(EventListener listener,
+      [bool useCapture = false]) {
+    _add(listener, useCapture);
+    return this;
+  }
+
+  _EventListenerListImpl remove(EventListener listener,
+      [bool useCapture = false]) {
+    _remove(listener, useCapture);
+    return this;
+  }
+
+  bool dispatch(Event evt) {
+    // TODO(jacobr): what is the correct behavior here. We could alternately
+    // force the event to have the expected type.
+    assert(evt.type == _type);
+    return _ptr.$dom_dispatchEvent(evt);
+  }
+
+  void _add(EventListener listener, bool useCapture) {
+    _ptr.$dom_addEventListener(_type, listener, useCapture);
+  }
+
+  void _remove(EventListener listener, bool useCapture) {
+    _ptr.$dom_removeEventListener(_type, listener, useCapture);
+  }
+}
+
+
+class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
+
+  Events get on() => new _EventsImpl(this);
+$!MEMBERS
+}
diff --git a/tools/VERSION b/tools/VERSION
index 453bc99..971672e 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
 MAJOR 0
-MINOR 1
-BUILD 2
-PATCH 0
+MINOR 4
+BUILD 6
+PATCH 1