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 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 class CheckedModeHelper { | 7 class CheckedModeHelper { |
8 final String name; | 8 final String name; |
9 | 9 |
10 const CheckedModeHelper(String this.name); | 10 const CheckedModeHelper(String this.name); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 class PropertyCheckedModeHelper extends CheckedModeHelper { | 84 class PropertyCheckedModeHelper extends CheckedModeHelper { |
85 const PropertyCheckedModeHelper(String name) : super(name); | 85 const PropertyCheckedModeHelper(String name) : super(name); |
86 | 86 |
87 void generateAdditionalArguments(SsaCodeGenerator codegen, | 87 void generateAdditionalArguments(SsaCodeGenerator codegen, |
88 HTypeConversion node, | 88 HTypeConversion node, |
89 List<jsAst.Expression> arguments) { | 89 List<jsAst.Expression> arguments) { |
90 DartType type = node.typeExpression; | 90 DartType type = node.typeExpression; |
91 String additionalArgument = codegen.backend.namer.operatorIsType(type); | 91 jsAst.Name additionalArgument = codegen.backend.namer.operatorIsType(type); |
92 arguments.add(js.string(additionalArgument)); | 92 arguments.add(js.quoteName(additionalArgument)); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 class TypeVariableCheckedModeHelper extends CheckedModeHelper { | 96 class TypeVariableCheckedModeHelper extends CheckedModeHelper { |
97 const TypeVariableCheckedModeHelper(String name) : super(name); | 97 const TypeVariableCheckedModeHelper(String name) : super(name); |
98 | 98 |
99 void generateAdditionalArguments(SsaCodeGenerator codegen, | 99 void generateAdditionalArguments(SsaCodeGenerator codegen, |
100 HTypeConversion node, | 100 HTypeConversion node, |
101 List<jsAst.Expression> arguments) { | 101 List<jsAst.Expression> arguments) { |
102 assert(node.typeExpression.isTypeVariable); | 102 assert(node.typeExpression.isTypeVariable); |
103 codegen.use(node.typeRepresentation); | 103 codegen.use(node.typeRepresentation); |
104 arguments.add(codegen.pop()); | 104 arguments.add(codegen.pop()); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 class SubtypeCheckedModeHelper extends CheckedModeHelper { | 108 class SubtypeCheckedModeHelper extends CheckedModeHelper { |
109 const SubtypeCheckedModeHelper(String name) : super(name); | 109 const SubtypeCheckedModeHelper(String name) : super(name); |
110 | 110 |
111 void generateAdditionalArguments(SsaCodeGenerator codegen, | 111 void generateAdditionalArguments(SsaCodeGenerator codegen, |
112 HTypeConversion node, | 112 HTypeConversion node, |
113 List<jsAst.Expression> arguments) { | 113 List<jsAst.Expression> arguments) { |
114 DartType type = node.typeExpression; | 114 DartType type = node.typeExpression; |
115 Element element = type.element; | 115 Element element = type.element; |
116 String isField = codegen.backend.namer.operatorIs(element); | 116 jsAst.Name isField = codegen.backend.namer.operatorIs(element); |
117 arguments.add(js.string(isField)); | 117 arguments.add(js.quoteName(isField)); |
118 codegen.use(node.typeRepresentation); | 118 codegen.use(node.typeRepresentation); |
119 arguments.add(codegen.pop()); | 119 arguments.add(codegen.pop()); |
120 String asField = codegen.backend.namer.substitutionName(element); | 120 jsAst.Name asField = codegen.backend.namer.substitutionName(element); |
121 arguments.add(js.string(asField)); | 121 arguments.add(js.quoteName(asField)); |
122 } | 122 } |
123 } | 123 } |
OLD | NEW |