Index: tests/compiler/dart2js_native/multiscript_part2_test.dart |
diff --git a/tests/compiler/dart2js_native/multiscript_part2_test.dart b/tests/compiler/dart2js_native/multiscript_part2_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..09c04866a877aa5961dadad20c1e53bf37e6ae28 |
--- /dev/null |
+++ b/tests/compiler/dart2js_native/multiscript_part2_test.dart |
@@ -0,0 +1,34 @@ |
+// Copyright (c) 2014, 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. |
+ |
+import "package:expect/expect.dart"; |
+ |
+// Methods on (shared) native classes should have DOM isolate affinity. |
+// Test that part1 and part2 can be loaded into the same JavaScript context |
+// without conflicts. |
+ |
+class A native "AA" { |
+ // [foo] is the same in both isolates but optimized differently. |
+ foo(x) => x is String; |
+ |
+ // [bar] has different definitions in the two isolates. |
+ bar(x) => 'two:$x'; |
+} |
+ |
+makeA() native; |
+ |
+void setup() native """ |
+// Use existing definition if present to force sharing. |
+if (typeof AA == "undefined") { |
+ AA = function AA() {}; |
+} |
+makeA = function(){return new AA;}; |
+"""; |
+ |
+main() { |
+ setup(); |
+ |
+ Expect.equals(false, makeA().foo(123)); |
+ Expect.equals('two:hi', makeA().bar('hi')); |
+} |