| 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 #library('native'); | 5 #library('native'); |
| 6 #import('leg.dart'); | 6 #import('leg.dart'); |
| 7 #import('elements/elements.dart'); | 7 #import('elements/elements.dart'); |
| 8 #import('scanner/scannerlib.dart'); | 8 #import('scanner/scannerlib.dart'); |
| 9 #import('ssa/ssa.dart'); | 9 #import('ssa/ssa.dart'); |
| 10 #import('tree/tree.dart'); | 10 #import('tree/tree.dart'); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 i++; | 127 i++; |
| 128 }); | 128 }); |
| 129 String foreignParameters = Strings.join(arguments, ','); | 129 String foreignParameters = Strings.join(arguments, ','); |
| 130 | 130 |
| 131 String methodName = builder.compiler.namer.instanceMethodName( | 131 String methodName = builder.compiler.namer.instanceMethodName( |
| 132 element.name, parameters.parameterCount); | 132 element.name, parameters.parameterCount); |
| 133 | 133 |
| 134 HInstruction thenInstruction; | 134 HInstruction thenInstruction; |
| 135 void visitThen() { | 135 void visitThen() { |
| 136 SourceString jsCode = new SourceString( | 136 SourceString jsCode = new SourceString( |
| 137 '$receiver${element.name}($foreignParameters)'); | 137 '$receiver${element.name.slowToString()}($foreignParameters)'); |
| 138 thenInstruction = | 138 thenInstruction = |
| 139 new HForeign(jsCode, const SourceString('Object'), inputs); | 139 new HForeign(jsCode, const SourceString('Object'), inputs); |
| 140 builder.add(thenInstruction); | 140 builder.add(thenInstruction); |
| 141 } | 141 } |
| 142 | 142 |
| 143 if (!element.isInstanceMember()) { | 143 if (!element.isInstanceMember()) { |
| 144 // If the method is a non-instance method, we just generate a direct | 144 // If the method is a non-instance method, we just generate a direct |
| 145 // call to the native method. | 145 // call to the native method. |
| 146 visitThen(); | 146 visitThen(); |
| 147 builder.stack.add(thenInstruction); | 147 builder.stack.add(thenInstruction); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 } else if (!node.arguments.tail.isEmpty()) { | 193 } else if (!node.arguments.tail.isEmpty()) { |
| 194 builder.compiler.cancel('More than one argument to native'); | 194 builder.compiler.cancel('More than one argument to native'); |
| 195 } else { | 195 } else { |
| 196 LiteralString jsCode = node.arguments.head; | 196 LiteralString jsCode = node.arguments.head; |
| 197 builder.push(new HForeign(builder.unquote(jsCode, 0), | 197 builder.push(new HForeign(builder.unquote(jsCode, 0), |
| 198 const SourceString('Object'), | 198 const SourceString('Object'), |
| 199 <HInstruction>[])); | 199 <HInstruction>[])); |
| 200 } | 200 } |
| 201 } | 201 } |
| OLD | NEW |