OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 /// This file use methods that aren't used by dart2js.dart, but that we wish to | |
6 /// keep anyway. This might be general API that isn't currently in use, | |
7 /// debugging aids, or API only used for testing (see TODO below). | |
8 | |
9 library dart2js.use_unused_api; | |
10 | |
11 import '../compiler.dart' as api; | |
12 | |
13 import 'colors.dart' as colors; | |
14 import 'constants/values.dart' as constants; | |
15 import 'cps_ir/cps_ir_builder.dart' as ir_builder; | |
16 import 'cps_ir/cps_ir_nodes_sexpr.dart' as cps_ir_nodes_sexpr; | |
17 import 'dart_types.dart' as dart_types; | |
18 import 'dart2js.dart' as dart2js; | |
19 import 'dart2jslib.dart' as dart2jslib; | |
20 import 'elements/elements.dart' as elements; | |
21 import 'elements/modelx.dart' as modelx; | |
22 import 'elements/visitor.dart' as elements_visitor; | |
23 import 'filenames.dart' as filenames; | |
24 import 'inferrer/concrete_types_inferrer.dart' as concrete_types_inferrer; | |
25 import 'inferrer/type_graph_inferrer.dart' as type_graph_inferrer; | |
26 import 'js/js.dart' as js; | |
27 import 'js_emitter/js_emitter.dart' as js_emitter; | |
28 import 'source_file_provider.dart' as source_file_provider; | |
29 import 'ssa/ssa.dart' as ssa; | |
30 import 'tree/tree.dart' as tree; | |
31 import 'universe/universe.dart' as universe; | |
32 import 'util/util.dart' as util; | |
33 | |
34 class ElementVisitor extends elements_visitor.ElementVisitor { | |
35 visitElement(e) {} | |
36 } | |
37 | |
38 void main(List<String> arguments) { | |
39 useApi(); | |
40 dart2js.main(arguments); | |
41 useConstant(null, null); | |
42 useNode(null); | |
43 useUtil(null); | |
44 useSetlet(null); | |
45 useImmutableEmptySet(null); | |
46 useElementVisitor(new ElementVisitor()); | |
47 useJs(new js.Program(null)); | |
48 useJs(new js.Blob(null)); | |
49 useJs(new js.NamedFunction(null, null)); | |
50 useConcreteTypesInferrer(null); | |
51 useColor(); | |
52 useFilenames(); | |
53 useSsa(null); | |
54 useCodeBuffer(null); | |
55 usedByTests(); | |
56 useElements(null, null, null); | |
57 useIr(null, null, null); | |
58 useCompiler(null); | |
59 useTypes(); | |
60 useCodeEmitterTask(null); | |
61 } | |
62 | |
63 useApi() { | |
64 api.ReadStringFromUri uri; | |
65 } | |
66 | |
67 void useConstant(constants.ConstantValue constant, | |
68 dart2jslib.ConstantSystem cs) { | |
69 constant.isObject; | |
70 cs.isBool(constant); | |
71 } | |
72 | |
73 void useNode(tree.Node node) { | |
74 node | |
75 ..asAsyncModifier() | |
76 ..asAwait() | |
77 ..asBreakStatement() | |
78 ..asCascade() | |
79 ..asCatchBlock() | |
80 ..asClassNode() | |
81 ..asCombinator() | |
82 ..asConditional() | |
83 ..asContinueStatement() | |
84 ..asErrorExpression() | |
85 ..asExport() | |
86 ..asFor() | |
87 ..asFunctionDeclaration() | |
88 ..asIf() | |
89 ..asLabeledStatement() | |
90 ..asLibraryDependency() | |
91 ..asLibraryName() | |
92 ..asLiteralDouble() | |
93 ..asLiteralList() | |
94 ..asLiteralMap() | |
95 ..asLiteralMapEntry() | |
96 ..asLiteralNull() | |
97 ..asLiteralSymbol() | |
98 ..asMetadata() | |
99 ..asModifiers() | |
100 ..asPart() | |
101 ..asPartOf() | |
102 ..asRethrow() | |
103 ..asReturn() | |
104 ..asStatement() | |
105 ..asStringInterpolation() | |
106 ..asStringInterpolationPart() | |
107 ..asStringJuxtaposition() | |
108 ..asStringNode() | |
109 ..asSwitchCase() | |
110 ..asSwitchStatement() | |
111 ..asTryStatement() | |
112 ..asTypeAnnotation() | |
113 ..asTypeVariable() | |
114 ..asTypedef() | |
115 ..asWhile() | |
116 ..asYield(); | |
117 } | |
118 | |
119 void useUtil(util.Link link) { | |
120 link.reversePrependAll(link); | |
121 util.longestCommonPrefixLength(null, null); | |
122 new util.Pair(null, null); | |
123 } | |
124 | |
125 void useSetlet(util.Setlet setlet) { | |
126 setlet.difference(setlet); | |
127 setlet.retainWhere(null); | |
128 } | |
129 | |
130 void useImmutableEmptySet(util.ImmutableEmptySet set) { | |
131 set.retainWhere(null); | |
132 } | |
133 | |
134 void useElementVisitor(ElementVisitor visitor) { | |
135 visitor | |
136 ..visit(null) | |
137 ..visitAbstractFieldElement(null) | |
138 ..visitAmbiguousElement(null) | |
139 ..visitBoxFieldElement(null) | |
140 ..visitClassElement(null) | |
141 ..visitClosureClassElement(null) | |
142 ..visitClosureFieldElement(null) | |
143 ..visitCompilationUnitElement(null) | |
144 ..visitConstructorBodyElement(null) | |
145 ..visitElement(null) | |
146 ..visitErroneousElement(null) | |
147 ..visitFieldParameterElement(null) | |
148 ..visitFunctionElement(null) | |
149 ..visitLibraryElement(null) | |
150 ..visitMixinApplicationElement(null) | |
151 ..visitPrefixElement(null) | |
152 ..visitScopeContainerElement(null) | |
153 ..visitTypeDeclarationElement(null) | |
154 ..visitTypeVariableElement(null) | |
155 ..visitTypedefElement(null) | |
156 ..visitVariableElement(null) | |
157 ..visitWarnOnUseElement(null); | |
158 } | |
159 | |
160 useJs(js.Node node) { | |
161 node.asVariableUse(); | |
162 } | |
163 | |
164 useConcreteTypesInferrer(concrete_types_inferrer.ConcreteTypesInferrer c) { | |
165 c.debug(); | |
166 } | |
167 | |
168 useColor() { | |
169 colors.white(null); | |
170 colors.blue(null); | |
171 colors.yellow(null); | |
172 colors.black(null); | |
173 } | |
174 | |
175 useFilenames() { | |
176 filenames.appendSlash(null); | |
177 } | |
178 | |
179 useSsa(ssa.HInstruction instruction) { | |
180 instruction.isConstantNumber(); | |
181 new ssa.HAndOrBlockInformation(null, null, null); | |
182 new ssa.HStatementSequenceInformation(null); | |
183 } | |
184 | |
185 useCodeBuffer(dart2jslib.CodeBuffer buffer) { | |
186 buffer.writeln(); | |
187 } | |
188 | |
189 usedByTests() { | |
190 // TODO(ahe): We should try to avoid including API used only for tests. In | |
191 // most cases, such API can be moved to a test library. | |
192 dart2jslib.World world = null; | |
193 dart2jslib.Compiler compiler = null; | |
194 compiler.currentlyInUserCode(); | |
195 type_graph_inferrer.TypeGraphInferrer typeGraphInferrer = null; | |
196 source_file_provider.SourceFileProvider sourceFileProvider = null; | |
197 world.hasAnyUserDefinedGetter(null); | |
198 typeGraphInferrer.getCallersOf(null); | |
199 dart_types.Types.sorted(null); | |
200 new dart_types.Types(compiler).copy(compiler); | |
201 new universe.TypedSelector.subclass(null, null, compiler.world); | |
202 new universe.TypedSelector.subtype(null, null, compiler.world); | |
203 new universe.TypedSelector.exact(null, null, compiler.world); | |
204 sourceFileProvider.readStringFromUri(null); | |
205 } | |
206 | |
207 useElements(elements.ClassElement e, elements.Name n, modelx.FieldElementX f) { | |
208 e.lookupClassMember(null); | |
209 e.lookupInterfaceMember(null); | |
210 n.isAccessibleFrom(null); | |
211 f.reuseElement(); | |
212 } | |
213 | |
214 useIr(cps_ir_nodes_sexpr.SExpressionStringifier stringifier, | |
215 ir_builder.IrBuilderTask task, | |
216 ir_builder.IrBuilder builder) { | |
217 new cps_ir_nodes_sexpr.SExpressionStringifier(); | |
218 stringifier | |
219 ..newContinuationName() | |
220 ..newValueName() | |
221 ..visitConstant(null) | |
222 ..visitContinuation(null) | |
223 ..visitDefinition(null) | |
224 ..visitExpression(null) | |
225 ..visitFunctionDefinition(null) | |
226 ..visitInvokeStatic(null) | |
227 ..visitLetCont(null) | |
228 ..visitNode(null) | |
229 ..visitParameter(null); | |
230 task | |
231 ..hasIr(null) | |
232 ..getIr(null); | |
233 builder | |
234 ..buildIntegerLiteral(null) | |
235 ..buildDoubleLiteral(null) | |
236 ..buildBooleanLiteral(null) | |
237 ..buildNullLiteral() | |
238 ..buildStringLiteral(null) | |
239 ..buildDynamicGet(null, null) | |
240 ..buildSuperGet(null); | |
241 } | |
242 | |
243 useCompiler(dart2jslib.Compiler compiler) { | |
244 compiler.libraryLoader | |
245 ..reset() | |
246 ..resetAsync(null) | |
247 ..lookupLibrary(null); | |
248 compiler.forgetElement(null); | |
249 } | |
250 | |
251 useTypes() { | |
252 new dart_types.ResolvedTypedefType(null, null, null).unalias(null); | |
253 } | |
254 | |
255 useCodeEmitterTask(js_emitter.CodeEmitterTask codeEmitterTask) { | |
256 codeEmitterTask.oldEmitter.clearCspPrecompiledNodes(); | |
257 } | |
OLD | NEW |