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

Side by Side Diff: compiler/java/com/google/dart/compiler/testing/TestCompilerContext.java

Issue 9289029: Added runtime type checking to the elements of list and map literals in dartc (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 package com.google.dart.compiler.testing; 5 package com.google.dart.compiler.testing;
6 6
7 import com.google.dart.compiler.CompilerConfiguration; 7 import com.google.dart.compiler.CompilerConfiguration;
8 import com.google.dart.compiler.DartCompilationError; 8 import com.google.dart.compiler.DartCompilationError;
9 import com.google.dart.compiler.DartCompilerContext; 9 import com.google.dart.compiler.DartCompilerContext;
10 import com.google.dart.compiler.DartCompilerListener; 10 import com.google.dart.compiler.DartCompilerListener;
11 import com.google.dart.compiler.DartSource; 11 import com.google.dart.compiler.DartSource;
12 import com.google.dart.compiler.DefaultCompilerConfiguration;
12 import com.google.dart.compiler.ErrorCode; 13 import com.google.dart.compiler.ErrorCode;
13 import com.google.dart.compiler.ErrorSeverity; 14 import com.google.dart.compiler.ErrorSeverity;
14 import com.google.dart.compiler.LibrarySource; 15 import com.google.dart.compiler.LibrarySource;
15 import com.google.dart.compiler.Source; 16 import com.google.dart.compiler.Source;
16 import com.google.dart.compiler.SubSystem; 17 import com.google.dart.compiler.SubSystem;
17 import com.google.dart.compiler.ast.DartUnit; 18 import com.google.dart.compiler.ast.DartUnit;
18 import com.google.dart.compiler.ast.LibraryUnit; 19 import com.google.dart.compiler.ast.LibraryUnit;
19 import com.google.dart.compiler.metrics.CompilerMetrics; 20 import com.google.dart.compiler.metrics.CompilerMetrics;
20 21
21 import java.io.IOException; 22 import java.io.IOException;
22 import java.io.Reader; 23 import java.io.Reader;
23 import java.io.Writer; 24 import java.io.Writer;
24 import java.net.URI; 25 import java.net.URI;
25 import java.util.ArrayList; 26 import java.util.ArrayList;
26 import java.util.Collections; 27 import java.util.Collections;
27 import java.util.EnumSet; 28 import java.util.EnumSet;
28 import java.util.List; 29 import java.util.List;
29 import java.util.Set; 30 import java.util.Set;
30 31
31 /** 32 /**
32 * Common context for test cases. 33 * Common context for test cases.
33 */ 34 */
34 public class TestCompilerContext implements DartCompilerListener, DartCompilerCo ntext { 35 public class TestCompilerContext implements DartCompilerListener, DartCompilerCo ntext {
35 36
36 private final Set<EventKind> ignoredEvents; 37 private final Set<EventKind> ignoredEvents;
37 final List<ErrorCode> errors; 38 final List<ErrorCode> errors;
38 private int typeErrorCount; 39 private int typeErrorCount;
39 private int warningCount; 40 private int warningCount;
40 private int errorCount; 41 private int errorCount;
42 private final CompilerConfiguration compilerConfiguration = new DefaultCompile rConfiguration();
41 43
42 /** 44 /**
43 * @param ignored list of events that will be ignored. All other events cause an AssertionError. 45 * @param ignored list of events that will be ignored. All other events cause an AssertionError.
44 */ 46 */
45 public TestCompilerContext(EventKind... ignored) { 47 public TestCompilerContext(EventKind... ignored) {
46 EnumSet<EventKind> set = EnumSet.noneOf(EventKind.class); 48 EnumSet<EventKind> set = EnumSet.noneOf(EventKind.class);
47 for (EventKind kind : ignored) { 49 for (EventKind kind : ignored) {
48 set.add(kind); 50 set.add(kind);
49 } 51 }
50 this.ignoredEvents = Collections.unmodifiableSet(set); 52 this.ignoredEvents = Collections.unmodifiableSet(set);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return errors; 131 return errors;
130 } 132 }
131 133
132 @Override 134 @Override
133 public boolean shouldWarnOnNoSuchType() { 135 public boolean shouldWarnOnNoSuchType() {
134 return false; 136 return false;
135 } 137 }
136 138
137 @Override 139 @Override
138 public CompilerConfiguration getCompilerConfiguration() { 140 public CompilerConfiguration getCompilerConfiguration() {
139 return null; 141 return compilerConfiguration;
140 } 142 }
141 143
142 public enum EventKind { 144 public enum EventKind {
143 ERROR, 145 ERROR,
144 TYPE_ERROR, 146 TYPE_ERROR,
145 WARNING; 147 WARNING;
146 } 148 }
147 149
148 @Override 150 @Override
149 public LibrarySource getSystemLibraryFor(String importSpec) { 151 public LibrarySource getSystemLibraryFor(String importSpec) {
150 return null; 152 return null;
151 } 153 }
152 154
153 @Override 155 @Override
154 public void unitAboutToCompile(DartSource source, boolean diet) { 156 public void unitAboutToCompile(DartSource source, boolean diet) {
155 } 157 }
156 158
157 @Override 159 @Override
158 public void unitCompiled(DartUnit unit) { 160 public void unitCompiled(DartUnit unit) {
159 } 161 }
160 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698