| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
| 9 * from the given element. | 9 * from the given element. |
| 10 */ | 10 */ |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 void computeRequiredTypeChecks() { | 178 void computeRequiredTypeChecks() { |
| 179 assert(checkedClasses == null && checkedFunctionTypes == null); | 179 assert(checkedClasses == null && checkedFunctionTypes == null); |
| 180 | 180 |
| 181 backend.rti.addImplicitChecks(compiler.codegenWorld, | 181 backend.rti.addImplicitChecks(compiler.codegenWorld, |
| 182 classesUsingTypeVariableTests); | 182 classesUsingTypeVariableTests); |
| 183 | 183 |
| 184 checkedClasses = new Set<ClassElement>(); | 184 checkedClasses = new Set<ClassElement>(); |
| 185 checkedFunctionTypes = new Set<FunctionType>(); | 185 checkedFunctionTypes = new Set<FunctionType>(); |
| 186 compiler.codegenWorld.isChecks.forEach((DartType t) { | 186 compiler.codegenWorld.isChecks.forEach((DartType t) { |
| 187 if (!t.isMalformed) { | 187 if (t is InterfaceType) { |
| 188 if (t is InterfaceType) { | 188 checkedClasses.add(t.element); |
| 189 checkedClasses.add(t.element); | 189 } else if (t is FunctionType) { |
| 190 } else if (t is FunctionType) { | 190 checkedFunctionTypes.add(t); |
| 191 checkedFunctionTypes.add(t); | |
| 192 } | |
| 193 } | 191 } |
| 194 }); | 192 }); |
| 195 } | 193 } |
| 196 | 194 |
| 197 ClassElement computeMixinClass(MixinApplicationElement mixinApplication) { | 195 ClassElement computeMixinClass(MixinApplicationElement mixinApplication) { |
| 198 ClassElement mixin = mixinApplication.mixin; | 196 ClassElement mixin = mixinApplication.mixin; |
| 199 while (mixin.isMixinApplication) { | 197 while (mixin.isMixinApplication) { |
| 200 mixinApplication = mixin; | 198 mixinApplication = mixin; |
| 201 mixin = mixinApplication.mixin; | 199 mixin = mixinApplication.mixin; |
| 202 } | 200 } |
| (...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 List<String> args = backend.isInterceptedMethod(member) | 1538 List<String> args = backend.isInterceptedMethod(member) |
| 1541 ? ['receiver', 'v'] | 1539 ? ['receiver', 'v'] |
| 1542 : ['v']; | 1540 : ['v']; |
| 1543 builder.addProperty(setterName, | 1541 builder.addProperty(setterName, |
| 1544 js.fun(args, js('$receiver.$fieldName = v'))); | 1542 js.fun(args, js('$receiver.$fieldName = v'))); |
| 1545 } | 1543 } |
| 1546 | 1544 |
| 1547 bool canGenerateCheckedSetter(Element member) { | 1545 bool canGenerateCheckedSetter(Element member) { |
| 1548 DartType type = member.computeType(compiler).unalias(compiler); | 1546 DartType type = member.computeType(compiler).unalias(compiler); |
| 1549 if (type.element.isTypeVariable() || | 1547 if (type.element.isTypeVariable() || |
| 1550 (type is FunctionType && type.containsTypeVariables) || | 1548 (type is FunctionType && type.containsTypeVariables) || |
| 1551 type.element == compiler.dynamicClass || | 1549 type.treatAsDynamic || |
| 1552 type.element == compiler.objectClass) { | 1550 type.element == compiler.objectClass) { |
| 1553 // TODO(ngeoffray): Support type checks on type parameters. | 1551 // TODO(ngeoffray): Support type checks on type parameters. |
| 1554 return false; | 1552 return false; |
| 1555 } | 1553 } |
| 1556 return true; | 1554 return true; |
| 1557 } | 1555 } |
| 1558 | 1556 |
| 1559 void generateCheckedSetter(Element member, | 1557 void generateCheckedSetter(Element member, |
| 1560 String fieldName, | 1558 String fieldName, |
| 1561 String accessorName, | 1559 String accessorName, |
| (...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3724 | 3722 |
| 3725 const String HOOKS_API_USAGE = """ | 3723 const String HOOKS_API_USAGE = """ |
| 3726 // The code supports the following hooks: | 3724 // The code supports the following hooks: |
| 3727 // dartPrint(message) - if this function is defined it is called | 3725 // dartPrint(message) - if this function is defined it is called |
| 3728 // instead of the Dart [print] method. | 3726 // instead of the Dart [print] method. |
| 3729 // dartMainRunner(main) - if this function is defined, the Dart [main] | 3727 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 3730 // method will not be invoked directly. | 3728 // method will not be invoked directly. |
| 3731 // Instead, a closure that will invoke [main] is | 3729 // Instead, a closure that will invoke [main] is |
| 3732 // passed to [dartMainRunner]. | 3730 // passed to [dartMainRunner]. |
| 3733 """; | 3731 """; |
| OLD | NEW |