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

Unified Diff: compiler/javatests/com/google/dart/compiler/resolver/MockLibraryUnit.java

Issue 8867001: Check for using 'this' and 'super'. Tests. Issue 662. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix for using this/super in field. Tweaks for comments. Created 9 years 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
Index: compiler/javatests/com/google/dart/compiler/resolver/MockLibraryUnit.java
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/MockLibraryUnit.java b/compiler/javatests/com/google/dart/compiler/resolver/MockLibraryUnit.java
new file mode 100644
index 0000000000000000000000000000000000000000..37bec076cb02980054b842e9dd30376b0c6c567b
--- /dev/null
+++ b/compiler/javatests/com/google/dart/compiler/resolver/MockLibraryUnit.java
@@ -0,0 +1,33 @@
+// Copyright (c) 2011, 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.
+package com.google.dart.compiler.resolver;
+
+import com.google.dart.compiler.LibrarySource;
+import com.google.dart.compiler.MockLibrarySource;
+import com.google.dart.compiler.ast.DartUnit;
+import com.google.dart.compiler.ast.LibraryUnit;
+
+/**
+ * Testing support for {@link LibraryUnit}.
+ */
+public final class MockLibraryUnit {
+ /**
+ * @return the mock {@link LibraryUnit}.
+ */
+ public static LibraryUnit create() {
+ LibrarySource librarySource = new MockLibrarySource();
+ return new LibraryUnit(librarySource);
+ }
+
+ /**
+ * Creates the mock {@link LibraryUnit} and sets it for given {@link DartUnit}.
+ *
+ * @return the mock {@link LibraryUnit}.
+ */
+ public static LibraryUnit create(DartUnit unit) {
+ LibraryUnit libraryUnit = create();
+ unit.setLibrary(libraryUnit);
+ return libraryUnit;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698