| 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 extends 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 useCodeBuffer(null); |
| 57 usedByTests(); |
| 58 } |
| 59 |
| 60 void useConstant(dart2jslib.Constant constant, dart2jslib.ConstantSystem cs) { |
| 61 constant.isObject(); |
| 62 cs.isBool(constant); |
| 63 } |
| 64 |
| 65 void useNode(tree.Node node) { |
| 66 node |
| 67 ..asBreakStatement() |
| 68 ..asCascade() |
| 69 ..asCatchBlock() |
| 70 ..asClassNode() |
| 71 ..asCombinator() |
| 72 ..asConditional() |
| 73 ..asContinueStatement() |
| 74 ..asErrorExpression() |
| 75 ..asExport() |
| 76 ..asFor() |
| 77 ..asFunctionDeclaration() |
| 78 ..asIf() |
| 79 ..asLabeledStatement() |
| 80 ..asLibraryDependency() |
| 81 ..asLibraryName() |
| 82 ..asLiteralDouble() |
| 83 ..asLiteralList() |
| 84 ..asLiteralMap() |
| 85 ..asLiteralMapEntry() |
| 86 ..asLiteralNull() |
| 87 ..asLiteralSymbol() |
| 88 ..asModifiers() |
| 89 ..asPart() |
| 90 ..asPartOf() |
| 91 ..asRethrow() |
| 92 ..asStatement() |
| 93 ..asStringInterpolation() |
| 94 ..asStringInterpolationPart() |
| 95 ..asStringJuxtaposition() |
| 96 ..asStringNode() |
| 97 ..asSwitchCase() |
| 98 ..asSwitchStatement() |
| 99 ..asTryStatement() |
| 100 ..asTypeAnnotation() |
| 101 ..asTypeVariable() |
| 102 ..asTypedef() |
| 103 ..asWhile(); |
| 104 } |
| 105 |
| 106 void useUtil(util.Link link) { |
| 107 link.reversePrependAll(link); |
| 108 util.trace(""); |
| 109 } |
| 110 |
| 111 void useElementVisitor(ElementVisitor visitor) { |
| 112 visitor |
| 113 ..visit(null) |
| 114 ..visitAbstractFieldElement(null) |
| 115 ..visitAmbiguousElement(null) |
| 116 ..visitBoxElement(null) |
| 117 ..visitBoxFieldElement(null) |
| 118 ..visitClassElement(null) |
| 119 ..visitClosureClassElement(null) |
| 120 ..visitClosureFieldElement(null) |
| 121 ..visitCompilationUnitElement(null) |
| 122 ..visitConstructorBodyElement(null) |
| 123 ..visitElement(null) |
| 124 ..visitErroneousElement(null) |
| 125 ..visitFieldParameterElement(null) |
| 126 ..visitFunctionElement(null) |
| 127 ..visitInterceptedElement(null) |
| 128 ..visitLabelElement(null) |
| 129 ..visitLibraryElement(null) |
| 130 ..visitMixinApplicationElement(null) |
| 131 ..visitPrefixElement(null) |
| 132 ..visitScopeContainerElement(null) |
| 133 ..visitTargetElement(null) |
| 134 ..visitThisElement(null) |
| 135 ..visitTypeDeclarationElement(null) |
| 136 ..visitTypeVariableElement(null) |
| 137 ..visitTypedefElement(null) |
| 138 ..visitVariableElement(null) |
| 139 ..visitVariableListElement(null) |
| 140 ..visitVoidElement(null) |
| 141 ..visitWarnOnUseElement(null); |
| 142 } |
| 143 |
| 144 useJs(js.Node node) { |
| 145 node.asVariableUse(); |
| 146 } |
| 147 |
| 148 useConcreteTypesInferrer(concrete_types_inferrer.ConcreteTypesInferrer c) { |
| 149 c.debug(); |
| 150 } |
| 151 |
| 152 useColor() { |
| 153 colors.white(null); |
| 154 colors.blue(null); |
| 155 colors.yellow(null); |
| 156 colors.black(null); |
| 157 } |
| 158 |
| 159 useFilenames() { |
| 160 filenames.appendSlash(null); |
| 161 } |
| 162 |
| 163 useSsa(ssa.HInstruction instruction) { |
| 164 instruction.isConstantNumber(); |
| 165 new ssa.HAndOrBlockInformation(null, null, null); |
| 166 new ssa.HStatementSequenceInformation(null); |
| 167 } |
| 168 |
| 169 useCodeBuffer(dart2jslib.CodeBuffer buffer) { |
| 170 buffer.writeln(); |
| 171 } |
| 172 |
| 173 usedByTests() { |
| 174 // TODO(ahe): We should try to avoid including API used only for tests. In |
| 175 // most cases, such API can be moved to a test library. |
| 176 dart2jslib.World world = null; |
| 177 dart2jslib.Compiler compiler = null; |
| 178 type_graph_inferrer.TypeGraphInferrer typeGraphInferrer = null; |
| 179 source_file_provider.SourceFileProvider sourceFileProvider = null; |
| 180 world.hasAnyUserDefinedGetter(null); |
| 181 compiler.importHelperLibrary(null); |
| 182 typeGraphInferrer.getCallersOf(null); |
| 183 dart_types.Types.sorted(null); |
| 184 new universe.TypedSelector.subclass(null, null); |
| 185 new universe.TypedSelector.subtype(null, null); |
| 186 new universe.TypedSelector.exact(null, null); |
| 187 sourceFileProvider.readStringFromUri(null); |
| 188 } |
| OLD | NEW |