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

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

Issue 707463003: Support enums in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 1 month 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 int maxConcreteTypeSize: 5, 66 int maxConcreteTypeSize: 5,
67 bool disableTypeInference: false, 67 bool disableTypeInference: false,
68 bool analyzeAll: false, 68 bool analyzeAll: false,
69 bool analyzeOnly: false, 69 bool analyzeOnly: false,
70 bool emitJavaScript: true, 70 bool emitJavaScript: true,
71 bool preserveComments: false, 71 bool preserveComments: false,
72 // Our unit tests check code generation output that is 72 // Our unit tests check code generation output that is
73 // affected by inlining support. 73 // affected by inlining support.
74 bool disableInlining: true, 74 bool disableInlining: true,
75 bool trustTypeAnnotations: false, 75 bool trustTypeAnnotations: false,
76 bool enableEnums: false,
76 int this.expectedWarnings, 77 int this.expectedWarnings,
77 int this.expectedErrors}) 78 int this.expectedErrors})
78 : sourceFiles = new Map<String, SourceFile>(), 79 : sourceFiles = new Map<String, SourceFile>(),
79 super(enableTypeAssertions: enableTypeAssertions, 80 super(enableTypeAssertions: enableTypeAssertions,
80 enableMinification: enableMinification, 81 enableMinification: enableMinification,
81 enableConcreteTypeInference: enableConcreteTypeInference, 82 enableConcreteTypeInference: enableConcreteTypeInference,
82 maxConcreteTypeSize: maxConcreteTypeSize, 83 maxConcreteTypeSize: maxConcreteTypeSize,
83 disableTypeInferenceFlag: disableTypeInference, 84 disableTypeInferenceFlag: disableTypeInference,
84 analyzeAllFlag: analyzeAll, 85 analyzeAllFlag: analyzeAll,
85 analyzeOnly: analyzeOnly, 86 analyzeOnly: analyzeOnly,
86 emitJavaScript: emitJavaScript, 87 emitJavaScript: emitJavaScript,
87 preserveComments: preserveComments, 88 preserveComments: preserveComments,
88 trustTypeAnnotations: trustTypeAnnotations, 89 trustTypeAnnotations: trustTypeAnnotations,
89 showPackageWarnings: true) { 90 showPackageWarnings: true,
91 enableEnums: enableEnums) {
90 this.disableInlining = disableInlining; 92 this.disableInlining = disableInlining;
91 93
92 deferredLoadTask = new MockDeferredLoadTask(this); 94 deferredLoadTask = new MockDeferredLoadTask(this);
93 95
94 clearMessages(); 96 clearMessages();
95 97
96 registerSource(Compiler.DART_CORE, 98 registerSource(Compiler.DART_CORE,
97 buildLibrarySource(DEFAULT_CORE_LIBRARY, coreSource)); 99 buildLibrarySource(DEFAULT_CORE_LIBRARY, coreSource));
98 registerSource(PATCH_CORE, DEFAULT_PATCH_CORE_SOURCE); 100 registerSource(PATCH_CORE, DEFAULT_PATCH_CORE_SOURCE);
99 101
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 264 }
263 265
264 Element lookupElementIn(ScopeContainerElement container, name) { 266 Element lookupElementIn(ScopeContainerElement container, name) {
265 Element element = container.localLookup(name); 267 Element element = container.localLookup(name);
266 return element != null 268 return element != null
267 ? element 269 ? element
268 : new ErroneousElementX(null, null, name, container); 270 : new ErroneousElementX(null, null, name, container);
269 } 271 }
270 272
271 /// Create a new [MockCompiler] and apply it asynchronously to [f]. 273 /// Create a new [MockCompiler] and apply it asynchronously to [f].
272 static Future create(f(MockCompiler compiler)) { 274 static Future create(f(MockCompiler compiler),
273 MockCompiler compiler = new MockCompiler.internal(); 275 {bool enableEnums: false}) {
276 MockCompiler compiler = new MockCompiler.internal(
277 enableEnums: enableEnums);
274 return compiler.init().then((_) => f(compiler)); 278 return compiler.init().then((_) => f(compiler));
275 } 279 }
276 } 280 }
277 281
278 /// A function the checks [message]. If the check fails or if [message] is 282 /// A function the checks [message]. If the check fails or if [message] is
279 /// `null`, an error string is returned. Otherwise `null` is returned. 283 /// `null`, an error string is returned. Otherwise `null` is returned.
280 typedef String CheckMessage(Message message); 284 typedef String CheckMessage(Message message);
281 285
282 CheckMessage checkMessage(MessageKind kind, Map arguments) { 286 CheckMessage checkMessage(MessageKind kind, Map arguments) {
283 return (Message message) { 287 return (Message message) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 MockElement(Element enclosingElement) 393 MockElement(Element enclosingElement)
390 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, 394 : super('', ElementKind.FUNCTION, Modifiers.EMPTY,
391 enclosingElement, false); 395 enclosingElement, false);
392 396
393 get node => null; 397 get node => null;
394 398
395 parseNode(_) => null; 399 parseNode(_) => null;
396 400
397 bool get hasNode => false; 401 bool get hasNode => false;
398 } 402 }
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