| 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 'dart2js.dart' as dart2js; |
| 12 |
| 13 import 'dart2jslib.dart' as dart2jslib; |
| 14 |
| 15 import 'tree/tree.dart' as tree; |
| 16 |
| 17 import 'util/util.dart' as util; |
| 18 |
| 19 import 'elements/visitor.dart' as elements_visitor; |
| 20 |
| 21 import 'js/js.dart' as js; |
| 22 |
| 23 import 'types/concrete_types_inferrer.dart' as concrete_types_inferrer; |
| 24 |
| 25 import 'colors.dart' as colors; |
| 26 |
| 27 import 'filenames.dart' as filenames; |
| 28 |
| 29 import 'dart_types.dart' as dart_types; |
| 30 |
| 31 import 'universe/universe.dart' as universe; |
| 32 |
| 33 import 'inferrer/type_graph_inferrer.dart' as type_graph_inferrer; |
| 34 |
| 35 import 'source_file_provider.dart' as source_file_provider; |
| 36 |
| 37 import 'ssa/ssa.dart' as ssa; |
| 38 |
| 39 class ElementVisitor implements elements_visitor.ElementVisitor { |
| 40 visitElement(e) {} |
| 41 } |
| 42 |
| 43 void main(List<String> arguments) { |
| 44 dart2js.main(arguments); |
| 45 useConstant(null, null); |
| 46 useNode(null); |
| 47 useUtil(null); |
| 48 useElementVisitor(new ElementVisitor()); |
| 49 useJs(new js.Program(null)); |
| 50 useJs(new js.Blob(null)); |
| 51 useJs(new js.NamedFunction(null, null)); |
| 52 useConcreteTypesInferrer(null); |
| 53 useColor(); |
| 54 useFilenames(); |
| 55 useSsa(null); |
| 56 usedByTests(); |
| 57 } |
| 58 |
| 59 void useConstant(dart2jslib.Constant constant, dart2jslib.ConstantSystem cs) { |
| 60 constant.isObject(); |
| 61 cs.isBool(constant); |
| 62 } |
| 63 |
| 64 void useNode(tree.Node node) { |
| 65 node |
| 66 ..asBreakStatement() |
| 67 ..asCascade() |
| 68 ..asCatchBlock() |
| 69 ..asClassNode() |
| 70 ..asCombinator() |
| 71 ..asConditional() |
| 72 ..asContinueStatement() |
| 73 ..asErrorExpression() |
| 74 ..asExport() |
| 75 ..asFor() |
| 76 ..asFunctionDeclaration() |
| 77 ..asIf() |
| 78 ..asLabeledStatement() |
| 79 ..asLibraryDependency() |
| 80 ..asLibraryName() |
| 81 ..asLiteralDouble() |
| 82 ..asLiteralList() |
| 83 ..asLiteralMap() |
| 84 ..asLiteralMapEntry() |
| 85 ..asLiteralNull() |
| 86 ..asLiteralSymbol() |
| 87 ..asModifiers() |
| 88 ..asPart() |
| 89 ..asPartOf() |
| 90 ..asRethrow() |
| 91 ..asStatement() |
| 92 ..asStringInterpolation() |
| 93 ..asStringInterpolationPart() |
| 94 ..asStringJuxtaposition() |
| 95 ..asStringNode() |
| 96 ..asSwitchCase() |
| 97 ..asSwitchStatement() |
| 98 ..asTryStatement() |
| 99 ..asTypeAnnotation() |
| 100 ..asTypeVariable() |
| 101 ..asTypedef() |
| 102 ..asWhile(); |
| 103 } |
| 104 |
| 105 void useUtil(util.Link link) { |
| 106 link.reversePrependAll(link); |
| 107 util.trace(""); |
| 108 } |
| 109 |
| 110 void useElementVisitor(ElementVisitor visitor) { |
| 111 visitor |
| 112 ..visit(null) |
| 113 ..visitAbstractFieldElement(null) |
| 114 ..visitAmbiguousElement(null) |
| 115 ..visitBoxElement(null) |
| 116 ..visitBoxFieldElement(null) |
| 117 ..visitClassElement(null) |
| 118 ..visitClosureClassElement(null) |
| 119 ..visitClosureFieldElement(null) |
| 120 ..visitCompilationUnitElement(null) |
| 121 ..visitConstructorBodyElement(null) |
| 122 ..visitElement(null) |
| 123 ..visitErroneousElement(null) |
| 124 ..visitFieldParameterElement(null) |
| 125 ..visitFunctionElement(null) |
| 126 ..visitInterceptedElement(null) |
| 127 ..visitLabelElement(null) |
| 128 ..visitLibraryElement(null) |
| 129 ..visitMixinApplicationElement(null) |
| 130 ..visitPrefixElement(null) |
| 131 ..visitScopeContainerElement(null) |
| 132 ..visitTargetElement(null) |
| 133 ..visitThisElement(null) |
| 134 ..visitTypeDeclarationElement(null) |
| 135 ..visitTypeVariableElement(null) |
| 136 ..visitTypedefElement(null) |
| 137 ..visitVariableElement(null) |
| 138 ..visitVariableListElement(null) |
| 139 ..visitVoidElement(null) |
| 140 ..visitWarnOnUseElement(null); |
| 141 } |
| 142 |
| 143 useJs(js.Node node) { |
| 144 node.asVariableUse(); |
| 145 } |
| 146 |
| 147 useConcreteTypesInferrer(concrete_types_inferrer.ConcreteTypesInferrer c) { |
| 148 c.debug(); |
| 149 } |
| 150 |
| 151 useColor() { |
| 152 colors.white(null); |
| 153 colors.blue(null); |
| 154 colors.yellow(null); |
| 155 colors.black(null); |
| 156 } |
| 157 |
| 158 useFilenames() { |
| 159 filenames.appendSlash(null); |
| 160 } |
| 161 |
| 162 useSsa(ssa.HInstruction instruction) { |
| 163 instruction.isConstantNumber(); |
| 164 } |
| 165 |
| 166 usedByTests() { |
| 167 // TODO(ahe): We should try to avoid including API used only for tests. In |
| 168 // most cases, such API can be moved to a test library. |
| 169 dart2jslib.World world = null; |
| 170 dart2jslib.Compiler compiler = null; |
| 171 type_graph_inferrer.TypeGraphInferrer typeGraphInferrer = null; |
| 172 source_file_provider.SourceFileProvider sourceFileProvider = null; |
| 173 world.hasAnyUserDefinedGetter(null); |
| 174 compiler.importHelperLibrary(null); |
| 175 typeGraphInferrer.getCallersOf(null); |
| 176 dart_types.Types.sorted(null); |
| 177 new universe.TypedSelector.subclass(null, null); |
| 178 new universe.TypedSelector.subtype(null, null); |
| 179 new universe.TypedSelector.exact(null, null); |
| 180 sourceFileProvider.readStringFromUri(null); |
| 181 } |
| OLD | NEW |