Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2498)

Unified Diff: dart/language/namer_test.dart

Issue 10581036: Ensure uniqueness of global names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update comment Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/.gitignore ('k') | dart/lib/compiler/implementation/namer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/language/namer_test.dart
diff --git a/dart/language/namer_test.dart b/dart/language/namer_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..67fa633a33e543ee0cd264493ca4f6220959a010
--- /dev/null
+++ b/dart/language/namer_test.dart
@@ -0,0 +1,63 @@
+// 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.
+
+// Regression test for a bug in dart2js where global names could
+// collide.
+
+var i = 'top level';
+
+var i0 = 'top level zero';
+
+var i00 = 'top level zero zero';
+
+var i2 = 'top level too';
+
+class A {
+ static var i = 'A';
+}
+
+var j = 'top level';
+
+var j0 = 'top level zero';
+
+var j00 = 'top level zero zero';
+
+var j2 = 'top level too';
+
+class B {
+ static var j = 'B';
+}
+
+var k = 'top level';
+
+var k0 = 'top level zero';
+
+var k00 = 'top level zero zero';
+
+var k2 = 'top level too';
+
+class C {
+ static var k = 'C';
+}
+
+main() {
+ // Order matters. This sequence triggered the bug.
+ Expect.equals('top level', i);
+ Expect.equals('A', A.i);
+ Expect.equals('top level too', i2);
+ Expect.equals('top level zero zero', i00);
+ Expect.equals('top level zero', i0);
+
+ Expect.equals('top level zero zero', j00);
+ Expect.equals('top level', j);
+ Expect.equals('top level too', j2);
+ Expect.equals('top level zero', j0);
+ Expect.equals('B', B.j);
+
+ Expect.equals('top level too', k2);
+ Expect.equals('top level zero', k0);
+ Expect.equals('top level', k);
+ Expect.equals('C', C.k);
+ Expect.equals('top level zero zero', k00);
+}
« no previous file with comments | « dart/.gitignore ('k') | dart/lib/compiler/implementation/namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698