| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.ir_builder_task; | 5 library dart2js.ir_builder_task; |
| 6 | 6 |
| 7 import '../closure.dart' as closurelib; | 7 import '../closure.dart' as closurelib; |
| 8 import '../closure.dart' hide ClosureScope; | 8 import '../closure.dart' hide ClosureScope; |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 final Compiler _compiler; | 2299 final Compiler _compiler; |
| 2300 JavaScriptBackend get _backend => _compiler.backend; | 2300 JavaScriptBackend get _backend => _compiler.backend; |
| 2301 | 2301 |
| 2302 GlobalProgramInformation(this._compiler); | 2302 GlobalProgramInformation(this._compiler); |
| 2303 | 2303 |
| 2304 /// Returns [true], if the analysis could not determine that the type | 2304 /// Returns [true], if the analysis could not determine that the type |
| 2305 /// arguments for the class [cls] are never used in the program. | 2305 /// arguments for the class [cls] are never used in the program. |
| 2306 bool requiresRuntimeTypesFor(ClassElement cls) { | 2306 bool requiresRuntimeTypesFor(ClassElement cls) { |
| 2307 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls); | 2307 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls); |
| 2308 } | 2308 } |
| 2309 |
| 2310 Set<ClassElement> get interceptedClasses => _backend.interceptedClasses; |
| 2309 } | 2311 } |
| 2310 | 2312 |
| 2311 /// IR builder specific to the JavaScript backend, coupled to the [JsIrBuilder]. | 2313 /// IR builder specific to the JavaScript backend, coupled to the [JsIrBuilder]. |
| 2312 class JsIrBuilderVisitor extends IrBuilderVisitor { | 2314 class JsIrBuilderVisitor extends IrBuilderVisitor { |
| 2313 /// Promote the type of [irBuilder] to [JsIrBuilder]. | 2315 /// Promote the type of [irBuilder] to [JsIrBuilder]. |
| 2314 JsIrBuilder get irBuilder => super.irBuilder; | 2316 JsIrBuilder get irBuilder => super.irBuilder; |
| 2315 | 2317 |
| 2316 JavaScriptBackend get backend => compiler.backend; | 2318 JavaScriptBackend get backend => compiler.backend; |
| 2317 | 2319 |
| 2318 /// Result of closure conversion for the current body of code. | 2320 /// Result of closure conversion for the current body of code. |
| 2319 /// | 2321 /// |
| 2320 /// Will be initialized upon entering the body of a function. | 2322 /// Will be initialized upon entering the body of a function. |
| 2321 /// It is computed by the [ClosureTranslator]. | 2323 /// It is computed by the [ClosureTranslator]. |
| 2322 ClosureClassMap closureClassMap; | 2324 ClosureClassMap closureClassMap; |
| 2323 | 2325 |
| 2324 /// During construction of a constructor factory, [fieldValues] maps fields | 2326 /// During construction of a constructor factory, [fieldValues] maps fields |
| 2325 /// to the primitive containing their initial value. | 2327 /// to the primitive containing their initial value. |
| 2326 Map<FieldElement, ir.Primitive> fieldValues = <FieldElement, ir.Primitive>{}; | 2328 Map<FieldElement, ir.Primitive> fieldValues = <FieldElement, ir.Primitive>{}; |
| 2327 | 2329 |
| 2328 JsIrBuilderVisitor(TreeElements elements, | 2330 JsIrBuilderVisitor(TreeElements elements, |
| 2329 Compiler compiler, | 2331 Compiler compiler, |
| 2330 SourceInformationBuilder sourceInformationBuilder) | 2332 SourceInformationBuilder sourceInformationBuilder) |
| 2331 : super(elements, compiler, sourceInformationBuilder); | 2333 : super(elements, compiler, sourceInformationBuilder); |
| 2332 | 2334 |
| 2335 |
| 2333 /// Builds the IR for creating an instance of the closure class corresponding | 2336 /// Builds the IR for creating an instance of the closure class corresponding |
| 2334 /// to the given nested function. | 2337 /// to the given nested function. |
| 2335 ClosureClassElement makeSubFunction(ast.FunctionExpression node) { | 2338 ClosureClassElement makeSubFunction(ast.FunctionExpression node) { |
| 2336 ClosureClassMap innerMap = | 2339 ClosureClassMap innerMap = |
| 2337 compiler.closureToClassMapper.getMappingForNestedFunction(node); | 2340 compiler.closureToClassMapper.getMappingForNestedFunction(node); |
| 2338 ClosureClassElement closureClass = innerMap.closureClassElement; | 2341 ClosureClassElement closureClass = innerMap.closureClassElement; |
| 2339 return closureClass; | 2342 return closureClass; |
| 2340 } | 2343 } |
| 2341 | 2344 |
| 2342 ir.Primitive visitFunctionExpression(ast.FunctionExpression node) { | 2345 ir.Primitive visitFunctionExpression(ast.FunctionExpression node) { |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3076 node.body = replacementFor(node.body); | 3079 node.body = replacementFor(node.body); |
| 3077 } | 3080 } |
| 3078 } | 3081 } |
| 3079 | 3082 |
| 3080 /// Visit a just-deleted subterm and unlink all [Reference]s in it. | 3083 /// Visit a just-deleted subterm and unlink all [Reference]s in it. |
| 3081 class RemovalVisitor extends ir.RecursiveVisitor { | 3084 class RemovalVisitor extends ir.RecursiveVisitor { |
| 3082 processReference(ir.Reference reference) { | 3085 processReference(ir.Reference reference) { |
| 3083 reference.unlink(); | 3086 reference.unlink(); |
| 3084 } | 3087 } |
| 3085 } | 3088 } |
| OLD | NEW |