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 ..asBreakStatement() | |
76 ..asCascade() | |
77 ..asCatchBlock() | |
78 ..asClassNode() | |
79 ..asCombinator() | |
80 ..asConditional() | |
81 ..asContinueStatement() | |
82 ..asErrorExpression() | |
83 ..asExport() | |
84 ..asFor() | |
85 ..asFunctionDeclaration() | |
86 ..asIf() | |
87 ..asLabeledStatement() | |
88 ..asLibraryDependency() | |
89 ..asLibraryName() | |
90 ..asLiteralDouble() | |
91 ..asLiteralList() | |
92 ..asLiteralMap() | |
93 ..asLiteralMapEntry() | |
94 ..asLiteralNull() | |
95 ..asLiteralSymbol() | |
96 ..asMetadata() | |
97 ..asModifiers() | |
98 ..asPart() | |
99 ..asPartOf() | |
100 ..asRethrow() | |
101 ..asReturn() | |
102 ..asStatement() | |
103 ..asStringInterpolation() | |
104 ..asStringInterpolationPart() | |
105 ..asStringJuxtaposition() | |
106 ..asStringNode() | |
107 ..asSwitchCase() | |
108 ..asSwitchStatement() | |
109 ..asTryStatement() | |
110 ..asTypeAnnotation() | |
111 ..asTypeVariable() | |
112 ..asTypedef() | |
113 ..asWhile(); | |
114 } | |
115 | |
116 void useUtil(util.Link link) { | |
117 link.reversePrependAll(link); | |
118 util.longestCommonPrefixLength(null, null); | |
119 new util.Pair(null, null); | |
120 } | |
121 | |
122 void useSetlet(util.Setlet setlet) { | |
123 setlet.difference(setlet); | |
124 setlet.retainWhere(null); | |
125 } | |
126 | |
127 void useImmutableEmptySet(util.ImmutableEmptySet set) { | |
128 set.retainWhere(null); | |
129 } | |
130 | |
131 void useElementVisitor(ElementVisitor visitor) { | |
132 visitor | |
133 ..visit(null) | |
134 ..visitAbstractFieldElement(null) | |
135 ..visitAmbiguousElement(null) | |
136 ..visitBoxFieldElement(null) | |
137 ..visitClassElement(null) | |
138 ..visitClosureClassElement(null) | |
139 ..visitClosureFieldElement(null) | |
140 ..visitCompilationUnitElement(null) | |
141 ..visitConstructorBodyElement(null) | |
142 ..visitElement(null) | |
143 ..visitErroneousElement(null) | |
144 ..visitFieldParameterElement(null) | |
145 ..visitFunctionElement(null) | |
146 ..visitLibraryElement(null) | |
147 ..visitMixinApplicationElement(null) | |
148 ..visitPrefixElement(null) | |
149 ..visitScopeContainerElement(null) | |
150 ..visitTypeDeclarationElement(null) | |
151 ..visitTypeVariableElement(null) | |
152 ..visitTypedefElement(null) | |
153 ..visitVariableElement(null) | |
154 ..visitWarnOnUseElement(null); | |
155 } | |
156 | |
157 useJs(js.Node node) { | |
158 node.asVariableUse(); | |
159 } | |
160 | |
161 useConcreteTypesInferrer(concrete_types_inferrer.ConcreteTypesInferrer c) { | |
162 c.debug(); | |
163 } | |
164 | |
165 useColor() { | |
166 colors.white(null); | |
167 colors.blue(null); | |
168 colors.yellow(null); | |
169 colors.black(null); | |
170 } | |
171 | |
172 useFilenames() { | |
173 filenames.appendSlash(null); | |
174 } | |
175 | |
176 useSsa(ssa.HInstruction instruction) { | |
177 instruction.isConstantNumber(); | |
178 new ssa.HAndOrBlockInformation(null, null, null); | |
179 new ssa.HStatementSequenceInformation(null); | |
180 } | |
181 | |
182 useCodeBuffer(dart2jslib.CodeBuffer buffer) { | |
183 buffer.writeln(); | |
184 } | |
185 | |
186 usedByTests() { | |
187 // TODO(ahe): We should try to avoid including API used only for tests. In | |
188 // most cases, such API can be moved to a test library. | |
189 dart2jslib.World world = null; | |
190 dart2jslib.Compiler compiler = null; | |
191 compiler.currentlyInUserCode(); | |
192 type_graph_inferrer.TypeGraphInferrer typeGraphInferrer = null; | |
193 source_file_provider.SourceFileProvider sourceFileProvider = null; | |
194 world.hasAnyUserDefinedGetter(null); | |
195 typeGraphInferrer.getCallersOf(null); | |
196 dart_types.Types.sorted(null); | |
197 new dart_types.Types(compiler).copy(compiler); | |
198 new universe.TypedSelector.subclass(null, null, compiler.world); | |
199 new universe.TypedSelector.subtype(null, null, compiler.world); | |
200 new universe.TypedSelector.exact(null, null, compiler.world); | |
201 sourceFileProvider.readStringFromUri(null); | |
202 } | |
203 | |
204 useElements(elements.ClassElement e, elements.Name n, modelx.FieldElementX f) { | |
205 e.lookupClassMember(null); | |
206 e.lookupInterfaceMember(null); | |
207 n.isAccessibleFrom(null); | |
208 f.reuseElement(); | |
209 } | |
210 | |
211 useIr(cps_ir_nodes_sexpr.SExpressionStringifier stringifier, | |
212 ir_builder.IrBuilderTask task, | |
213 ir_builder.IrBuilder builder) { | |
214 new cps_ir_nodes_sexpr.SExpressionStringifier(); | |
215 stringifier | |
216 ..newContinuationName() | |
217 ..newValueName() | |
218 ..visitConstant(null) | |
219 ..visitContinuation(null) | |
220 ..visitDefinition(null) | |
221 ..visitExpression(null) | |
222 ..visitFunctionDefinition(null) | |
223 ..visitInvokeStatic(null) | |
224 ..visitLetCont(null) | |
225 ..visitNode(null) | |
226 ..visitParameter(null); | |
227 task | |
228 ..hasIr(null) | |
229 ..getIr(null); | |
230 builder | |
231 ..buildIntegerLiteral(null) | |
232 ..buildDoubleLiteral(null) | |
233 ..buildBooleanLiteral(null) | |
234 ..buildNullLiteral() | |
235 ..buildStringLiteral(null) | |
236 ..buildDynamicGet(null, null); | |
237 } | |
238 | |
239 useCompiler(dart2jslib.Compiler compiler) { | |
240 compiler.libraryLoader | |
241 ..reset() | |
242 ..resetAsync(null) | |
243 ..lookupLibrary(null); | |
244 compiler.forgetElement(null); | |
245 } | |
246 | |
247 useTypes() { | |
248 new dart_types.ResolvedTypedefType(null, null, null).unalias(null); | |
249 } | |
250 | |
251 useCodeEmitterTask(js_emitter.CodeEmitterTask codeEmitterTask) { | |
252 codeEmitterTask.oldEmitter.clearCspPrecompiledNodes(); | |
253 } | |
OLD | NEW |