| OLD | NEW |
| 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 /// This file use methods that aren't used by dart2js.dart, but that we wish to | 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, | 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). | 7 /// debugging aids, or API only used for testing (see TODO below). |
| 8 | 8 |
| 9 library dart2js.use_unused_api; | 9 library dart2js.use_unused_api; |
| 10 | 10 |
| 11 import '../compiler.dart' as api; |
| 12 |
| 11 import 'dart2js.dart' as dart2js; | 13 import 'dart2js.dart' as dart2js; |
| 12 | 14 |
| 13 import 'dart2jslib.dart' as dart2jslib; | 15 import 'dart2jslib.dart' as dart2jslib; |
| 14 | 16 |
| 15 import 'tree/tree.dart' as tree; | 17 import 'tree/tree.dart' as tree; |
| 16 | 18 |
| 17 import 'util/util.dart' as util; | 19 import 'util/util.dart' as util; |
| 18 | 20 |
| 19 import 'elements/elements.dart' as elements; | 21 import 'elements/elements.dart' as elements; |
| 20 | 22 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 31 import 'dart_types.dart' as dart_types; | 33 import 'dart_types.dart' as dart_types; |
| 32 | 34 |
| 33 import 'universe/universe.dart' as universe; | 35 import 'universe/universe.dart' as universe; |
| 34 | 36 |
| 35 import 'inferrer/type_graph_inferrer.dart' as type_graph_inferrer; | 37 import 'inferrer/type_graph_inferrer.dart' as type_graph_inferrer; |
| 36 | 38 |
| 37 import 'source_file_provider.dart' as source_file_provider; | 39 import 'source_file_provider.dart' as source_file_provider; |
| 38 | 40 |
| 39 import 'ssa/ssa.dart' as ssa; | 41 import 'ssa/ssa.dart' as ssa; |
| 40 | 42 |
| 43 import 'ir/ir_nodes.dart' as ir_nodes; |
| 44 |
| 45 import 'ir/ir_builder.dart' as ir_builder; |
| 46 |
| 41 class ElementVisitor extends elements_visitor.ElementVisitor { | 47 class ElementVisitor extends elements_visitor.ElementVisitor { |
| 42 visitElement(e) {} | 48 visitElement(e) {} |
| 43 } | 49 } |
| 44 | 50 |
| 45 void main(List<String> arguments) { | 51 void main(List<String> arguments) { |
| 52 useApi(); |
| 46 dart2js.main(arguments); | 53 dart2js.main(arguments); |
| 47 useConstant(null, null); | 54 useConstant(null, null); |
| 48 useNode(null); | 55 useNode(null); |
| 49 useUtil(null); | 56 useUtil(null); |
| 50 useElementVisitor(new ElementVisitor()); | 57 useElementVisitor(new ElementVisitor()); |
| 51 useJs(new js.Program(null)); | 58 useJs(new js.Program(null)); |
| 52 useJs(new js.Blob(null)); | 59 useJs(new js.Blob(null)); |
| 53 useJs(new js.NamedFunction(null, null)); | 60 useJs(new js.NamedFunction(null, null)); |
| 54 useConcreteTypesInferrer(null); | 61 useConcreteTypesInferrer(null); |
| 55 useColor(); | 62 useColor(); |
| 56 useFilenames(); | 63 useFilenames(); |
| 57 useSsa(null); | 64 useSsa(null); |
| 58 useCodeBuffer(null); | 65 useCodeBuffer(null); |
| 59 usedByTests(); | 66 usedByTests(); |
| 60 useElements(null, null); | 67 useElements(null, null); |
| 68 useIr(null, null); |
| 69 } |
| 70 |
| 71 useApi() { |
| 72 api.ReadStringFromUri uri; |
| 61 } | 73 } |
| 62 | 74 |
| 63 void useConstant(dart2jslib.Constant constant, dart2jslib.ConstantSystem cs) { | 75 void useConstant(dart2jslib.Constant constant, dart2jslib.ConstantSystem cs) { |
| 64 constant.isObject; | 76 constant.isObject; |
| 65 cs.isBool(constant); | 77 cs.isBool(constant); |
| 66 } | 78 } |
| 67 | 79 |
| 68 void useNode(tree.Node node) { | 80 void useNode(tree.Node node) { |
| 69 node | 81 node |
| 70 ..asBreakStatement() | 82 ..asBreakStatement() |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 ..asSwitchStatement() | 114 ..asSwitchStatement() |
| 103 ..asTryStatement() | 115 ..asTryStatement() |
| 104 ..asTypeAnnotation() | 116 ..asTypeAnnotation() |
| 105 ..asTypeVariable() | 117 ..asTypeVariable() |
| 106 ..asTypedef() | 118 ..asTypedef() |
| 107 ..asWhile(); | 119 ..asWhile(); |
| 108 } | 120 } |
| 109 | 121 |
| 110 void useUtil(util.Link link) { | 122 void useUtil(util.Link link) { |
| 111 link.reversePrependAll(link); | 123 link.reversePrependAll(link); |
| 112 util.trace(""); | |
| 113 } | 124 } |
| 114 | 125 |
| 115 void useElementVisitor(ElementVisitor visitor) { | 126 void useElementVisitor(ElementVisitor visitor) { |
| 116 visitor | 127 visitor |
| 117 ..visit(null) | 128 ..visit(null) |
| 118 ..visitAbstractFieldElement(null) | 129 ..visitAbstractFieldElement(null) |
| 119 ..visitAmbiguousElement(null) | 130 ..visitAmbiguousElement(null) |
| 120 ..visitBoxElement(null) | 131 ..visitBoxElement(null) |
| 121 ..visitBoxFieldElement(null) | 132 ..visitBoxFieldElement(null) |
| 122 ..visitClassElement(null) | 133 ..visitClassElement(null) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 useCodeBuffer(dart2jslib.CodeBuffer buffer) { | 183 useCodeBuffer(dart2jslib.CodeBuffer buffer) { |
| 173 buffer.writeln(); | 184 buffer.writeln(); |
| 174 } | 185 } |
| 175 | 186 |
| 176 usedByTests() { | 187 usedByTests() { |
| 177 // TODO(ahe): We should try to avoid including API used only for tests. In | 188 // TODO(ahe): We should try to avoid including API used only for tests. In |
| 178 // most cases, such API can be moved to a test library. | 189 // most cases, such API can be moved to a test library. |
| 179 dart2jslib.World world = null; | 190 dart2jslib.World world = null; |
| 180 dart2jslib.Compiler compiler = null; | 191 dart2jslib.Compiler compiler = null; |
| 181 compiler.currentlyInUserCode(); | 192 compiler.currentlyInUserCode(); |
| 182 compiler.inUserCode(null); | |
| 183 type_graph_inferrer.TypeGraphInferrer typeGraphInferrer = null; | 193 type_graph_inferrer.TypeGraphInferrer typeGraphInferrer = null; |
| 184 source_file_provider.SourceFileProvider sourceFileProvider = null; | 194 source_file_provider.SourceFileProvider sourceFileProvider = null; |
| 185 world.hasAnyUserDefinedGetter(null); | 195 world.hasAnyUserDefinedGetter(null); |
| 186 compiler.importHelperLibrary(null); | 196 compiler.importHelperLibrary(null); |
| 187 typeGraphInferrer.getCallersOf(null); | 197 typeGraphInferrer.getCallersOf(null); |
| 188 dart_types.Types.sorted(null); | 198 dart_types.Types.sorted(null); |
| 189 new universe.TypedSelector.subclass(null, null); | 199 new universe.TypedSelector.subclass(null, null); |
| 190 new universe.TypedSelector.subtype(null, null); | 200 new universe.TypedSelector.subtype(null, null); |
| 191 new universe.TypedSelector.exact(null, null); | 201 new universe.TypedSelector.exact(null, null); |
| 192 sourceFileProvider.readStringFromUri(null); | 202 sourceFileProvider.readStringFromUri(null); |
| 193 } | 203 } |
| 194 | 204 |
| 195 useElements(elements.ClassElement e, elements.Name n) { | 205 useElements(elements.ClassElement e, elements.Name n) { |
| 196 e.lookupClassMember(null); | 206 e.lookupClassMember(null); |
| 197 e.lookupInterfaceMember(null); | 207 e.lookupInterfaceMember(null); |
| 198 n.isAccessibleFrom(null); | 208 n.isAccessibleFrom(null); |
| 209 } |
| 210 |
| 211 useIr(ir_nodes.SExpressionStringifier stringifier, |
| 212 ir_builder.IrBuilderTask task) { |
| 213 new ir_nodes.SExpressionStringifier(); |
| 214 stringifier |
| 215 ..newContinuationName() |
| 216 ..newValueName() |
| 217 ..visitConstant(null) |
| 218 ..visitContinuation(null) |
| 219 ..visitDefinition(null) |
| 220 ..visitExpression(null) |
| 221 ..visitFunction(null) |
| 222 ..visitInvokeStatic(null) |
| 223 ..visitLetCont(null) |
| 224 ..visitLetVal(null) |
| 225 ..visitNode(null) |
| 226 ..visitParameter(null); |
| 227 task |
| 228 ..hasIr(null) |
| 229 ..getIr(null); |
| 199 } | 230 } |
| OLD | NEW |