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

Side by Side Diff: tests/compiler/dart2js/mock_compiler.dart

Issue 871863006: Enable enums by default. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove the field in Compiler. Created 5 years, 10 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
« no previous file with comments | « pkg/compiler/lib/src/warnings.dart ('k') | tests/compiler/dart2js/resolver_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library mock_compiler; 5 library mock_compiler;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:collection'; 9 import 'dart:collection';
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 int maxConcreteTypeSize: 5, 67 int maxConcreteTypeSize: 5,
68 bool disableTypeInference: false, 68 bool disableTypeInference: false,
69 bool analyzeAll: false, 69 bool analyzeAll: false,
70 bool analyzeOnly: false, 70 bool analyzeOnly: false,
71 bool emitJavaScript: true, 71 bool emitJavaScript: true,
72 bool preserveComments: false, 72 bool preserveComments: false,
73 // Our unit tests check code generation output that is 73 // Our unit tests check code generation output that is
74 // affected by inlining support. 74 // affected by inlining support.
75 bool disableInlining: true, 75 bool disableInlining: true,
76 bool trustTypeAnnotations: false, 76 bool trustTypeAnnotations: false,
77 bool enableEnums: false,
78 int this.expectedWarnings, 77 int this.expectedWarnings,
79 int this.expectedErrors, 78 int this.expectedErrors,
80 api.CompilerOutputProvider outputProvider, 79 api.CompilerOutputProvider outputProvider,
81 String patchVersion}) 80 String patchVersion})
82 : sourceFiles = new Map<String, SourceFile>(), 81 : sourceFiles = new Map<String, SourceFile>(),
83 testedPatchVersion = patchVersion, 82 testedPatchVersion = patchVersion,
84 super(enableTypeAssertions: enableTypeAssertions, 83 super(enableTypeAssertions: enableTypeAssertions,
85 enableMinification: enableMinification, 84 enableMinification: enableMinification,
86 enableConcreteTypeInference: enableConcreteTypeInference, 85 enableConcreteTypeInference: enableConcreteTypeInference,
87 maxConcreteTypeSize: maxConcreteTypeSize, 86 maxConcreteTypeSize: maxConcreteTypeSize,
88 disableTypeInferenceFlag: disableTypeInference, 87 disableTypeInferenceFlag: disableTypeInference,
89 analyzeAllFlag: analyzeAll, 88 analyzeAllFlag: analyzeAll,
90 analyzeOnly: analyzeOnly, 89 analyzeOnly: analyzeOnly,
91 emitJavaScript: emitJavaScript, 90 emitJavaScript: emitJavaScript,
92 preserveComments: preserveComments, 91 preserveComments: preserveComments,
93 trustTypeAnnotations: trustTypeAnnotations, 92 trustTypeAnnotations: trustTypeAnnotations,
94 showPackageWarnings: true, 93 showPackageWarnings: true,
95 enableEnums: enableEnums,
96 outputProvider: outputProvider) { 94 outputProvider: outputProvider) {
97 this.disableInlining = disableInlining; 95 this.disableInlining = disableInlining;
98 96
99 deferredLoadTask = new MockDeferredLoadTask(this); 97 deferredLoadTask = new MockDeferredLoadTask(this);
100 98
101 clearMessages(); 99 clearMessages();
102 100
103 registerSource(Compiler.DART_CORE, 101 registerSource(Compiler.DART_CORE,
104 buildLibrarySource(DEFAULT_CORE_LIBRARY, coreSource)); 102 buildLibrarySource(DEFAULT_CORE_LIBRARY, coreSource));
105 registerSource(PATCH_CORE, DEFAULT_PATCH_CORE_SOURCE); 103 registerSource(PATCH_CORE, DEFAULT_PATCH_CORE_SOURCE);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 265 }
268 266
269 Element lookupElementIn(ScopeContainerElement container, name) { 267 Element lookupElementIn(ScopeContainerElement container, name) {
270 Element element = container.localLookup(name); 268 Element element = container.localLookup(name);
271 return element != null 269 return element != null
272 ? element 270 ? element
273 : new ErroneousElementX(null, null, name, container); 271 : new ErroneousElementX(null, null, name, container);
274 } 272 }
275 273
276 /// Create a new [MockCompiler] and apply it asynchronously to [f]. 274 /// Create a new [MockCompiler] and apply it asynchronously to [f].
277 static Future create(f(MockCompiler compiler), 275 static Future create(f(MockCompiler compiler)) {
278 {bool enableEnums: false}) { 276 MockCompiler compiler = new MockCompiler.internal();
279 MockCompiler compiler = new MockCompiler.internal(
280 enableEnums: enableEnums);
281 return compiler.init().then((_) => f(compiler)); 277 return compiler.init().then((_) => f(compiler));
282 } 278 }
283 } 279 }
284 280
285 /// A function the checks [message]. If the check fails or if [message] is 281 /// A function the checks [message]. If the check fails or if [message] is
286 /// `null`, an error string is returned. Otherwise `null` is returned. 282 /// `null`, an error string is returned. Otherwise `null` is returned.
287 typedef String CheckMessage(Message message); 283 typedef String CheckMessage(Message message);
288 284
289 CheckMessage checkMessage(MessageKind kind, Map arguments) { 285 CheckMessage checkMessage(MessageKind kind, Map arguments) {
290 return (Message message) { 286 return (Message message) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 MockElement(Element enclosingElement) 392 MockElement(Element enclosingElement)
397 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, 393 : super('', ElementKind.FUNCTION, Modifiers.EMPTY,
398 enclosingElement, false); 394 enclosingElement, false);
399 395
400 get node => null; 396 get node => null;
401 397
402 parseNode(_) => null; 398 parseNode(_) => null;
403 399
404 bool get hasNode => false; 400 bool get hasNode => false;
405 } 401 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/warnings.dart ('k') | tests/compiler/dart2js/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698