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

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

Issue 886773004: Supported versioned patching. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 List<WarningMessage> hints; 50 List<WarningMessage> hints;
51 List<WarningMessage> infos; 51 List<WarningMessage> infos;
52 List<WarningMessage> crashes; 52 List<WarningMessage> crashes;
53 /// Expected number of warnings. If `null`, the number of warnings is 53 /// Expected number of warnings. If `null`, the number of warnings is
54 /// not checked. 54 /// not checked.
55 final int expectedWarnings; 55 final int expectedWarnings;
56 /// Expected number of errors. If `null`, the number of errors is not checked. 56 /// Expected number of errors. If `null`, the number of errors is not checked.
57 final int expectedErrors; 57 final int expectedErrors;
58 final Map<String, SourceFile> sourceFiles; 58 final Map<String, SourceFile> sourceFiles;
59 Node parsedTree; 59 Node parsedTree;
60 final String testedPatchVersion;
60 61
61 MockCompiler.internal( 62 MockCompiler.internal(
62 {Map<String, String> coreSource, 63 {Map<String, String> coreSource,
63 bool enableTypeAssertions: false, 64 bool enableTypeAssertions: false,
64 bool enableMinification: false, 65 bool enableMinification: false,
65 bool enableConcreteTypeInference: false, 66 bool enableConcreteTypeInference: false,
66 int maxConcreteTypeSize: 5, 67 int maxConcreteTypeSize: 5,
67 bool disableTypeInference: false, 68 bool disableTypeInference: false,
68 bool analyzeAll: false, 69 bool analyzeAll: false,
69 bool analyzeOnly: false, 70 bool analyzeOnly: false,
70 bool emitJavaScript: true, 71 bool emitJavaScript: true,
71 bool preserveComments: false, 72 bool preserveComments: false,
72 // Our unit tests check code generation output that is 73 // Our unit tests check code generation output that is
73 // affected by inlining support. 74 // affected by inlining support.
74 bool disableInlining: true, 75 bool disableInlining: true,
75 bool trustTypeAnnotations: false, 76 bool trustTypeAnnotations: false,
76 bool enableEnums: false, 77 bool enableEnums: false,
77 int this.expectedWarnings, 78 int this.expectedWarnings,
78 int this.expectedErrors, 79 int this.expectedErrors,
79 api.CompilerOutputProvider outputProvider}) 80 api.CompilerOutputProvider outputProvider,
81 String patchVersion})
80 : sourceFiles = new Map<String, SourceFile>(), 82 : sourceFiles = new Map<String, SourceFile>(),
83 testedPatchVersion = patchVersion,
81 super(enableTypeAssertions: enableTypeAssertions, 84 super(enableTypeAssertions: enableTypeAssertions,
82 enableMinification: enableMinification, 85 enableMinification: enableMinification,
83 enableConcreteTypeInference: enableConcreteTypeInference, 86 enableConcreteTypeInference: enableConcreteTypeInference,
84 maxConcreteTypeSize: maxConcreteTypeSize, 87 maxConcreteTypeSize: maxConcreteTypeSize,
85 disableTypeInferenceFlag: disableTypeInference, 88 disableTypeInferenceFlag: disableTypeInference,
86 analyzeAllFlag: analyzeAll, 89 analyzeAllFlag: analyzeAll,
87 analyzeOnly: analyzeOnly, 90 analyzeOnly: analyzeOnly,
88 emitJavaScript: emitJavaScript, 91 emitJavaScript: emitJavaScript,
89 preserveComments: preserveComments, 92 preserveComments: preserveComments,
90 trustTypeAnnotations: trustTypeAnnotations, 93 trustTypeAnnotations: trustTypeAnnotations,
(...skipping 17 matching lines...) Expand all
108 registerSource(JavaScriptBackend.DART_INTERCEPTORS, 111 registerSource(JavaScriptBackend.DART_INTERCEPTORS,
109 buildLibrarySource(DEFAULT_INTERCEPTORS_LIBRARY)); 112 buildLibrarySource(DEFAULT_INTERCEPTORS_LIBRARY));
110 registerSource(JavaScriptBackend.DART_ISOLATE_HELPER, 113 registerSource(JavaScriptBackend.DART_ISOLATE_HELPER,
111 buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY)); 114 buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY));
112 registerSource(Compiler.DART_MIRRORS, 115 registerSource(Compiler.DART_MIRRORS,
113 buildLibrarySource(DEFAULT_MIRRORS_LIBRARY)); 116 buildLibrarySource(DEFAULT_MIRRORS_LIBRARY));
114 registerSource(Compiler.DART_ASYNC, 117 registerSource(Compiler.DART_ASYNC,
115 buildLibrarySource(DEFAULT_ASYNC_LIBRARY)); 118 buildLibrarySource(DEFAULT_ASYNC_LIBRARY));
116 } 119 }
117 120
121 String get patchVersion {
122 return testedPatchVersion != null ? testedPatchVersion : super.patchVersion;
123 }
124
118 /// Initialize the mock compiler with an empty main library. 125 /// Initialize the mock compiler with an empty main library.
119 Future<Uri> init([String mainSource = ""]) { 126 Future<Uri> init([String mainSource = ""]) {
120 Uri uri = new Uri(scheme: "mock"); 127 Uri uri = new Uri(scheme: "mock");
121 registerSource(uri, mainSource); 128 registerSource(uri, mainSource);
122 return libraryLoader.loadLibrary(uri) 129 return libraryLoader.loadLibrary(uri)
123 .then((LibraryElement library) { 130 .then((LibraryElement library) {
124 mainApp = library; 131 mainApp = library;
125 // We need to make sure the Object class is resolved. When registering a 132 // We need to make sure the Object class is resolved. When registering a
126 // dynamic invocation the ArgumentTypesRegistry eventually iterates over 133 // dynamic invocation the ArgumentTypesRegistry eventually iterates over
127 // the interfaces of the Object class which would be 'null' if the class 134 // the interfaces of the Object class which would be 'null' if the class
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 MockElement(Element enclosingElement) 396 MockElement(Element enclosingElement)
390 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, 397 : super('', ElementKind.FUNCTION, Modifiers.EMPTY,
391 enclosingElement, false); 398 enclosingElement, false);
392 399
393 get node => null; 400 get node => null;
394 401
395 parseNode(_) => null; 402 parseNode(_) => null;
396 403
397 bool get hasNode => false; 404 bool get hasNode => false;
398 } 405 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698