| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 import '../common.dart'; | 5 import '../common.dart'; |
| 6 import '../compiler.dart' show | 6 import '../compiler.dart' show |
| 7 Compiler; | 7 Compiler; |
| 8 import '../constants/values.dart'; | 8 import '../constants/values.dart'; |
| 9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // Check which pattern this native method follows: | 48 // Check which pattern this native method follows: |
| 49 // 1) foo() native; | 49 // 1) foo() native; |
| 50 // hasBody = false | 50 // hasBody = false |
| 51 // 2) foo() native "bar"; | 51 // 2) foo() native "bar"; |
| 52 // No longer supported, this is now done with @JSName('foo') and case 1. | 52 // No longer supported, this is now done with @JSName('foo') and case 1. |
| 53 // 3) foo() native "return 42"; | 53 // 3) foo() native "return 42"; |
| 54 // hasBody = true | 54 // hasBody = true |
| 55 bool hasBody = false; | 55 bool hasBody = false; |
| 56 assert(backend.isNative(element)); | 56 assert(backend.isNative(element)); |
| 57 String nativeMethodName = backend.getFixedBackendName(element); | 57 String nativeMethodName = backend.nativeData.getFixedBackendName(element); |
| 58 if (nativeBody != null) { | 58 if (nativeBody != null) { |
| 59 LiteralString jsCode = nativeBody.asLiteralString(); | 59 LiteralString jsCode = nativeBody.asLiteralString(); |
| 60 String str = jsCode.dartString.slowToString(); | 60 String str = jsCode.dartString.slowToString(); |
| 61 if (nativeRedirectionRegExp.hasMatch(str)) { | 61 if (nativeRedirectionRegExp.hasMatch(str)) { |
| 62 reporter.internalError( | 62 reporter.internalError( |
| 63 nativeBody, "Deprecated syntax, use @JSName('name') instead."); | 63 nativeBody, "Deprecated syntax, use @JSName('name') instead."); |
| 64 } | 64 } |
| 65 hasBody = true; | 65 hasBody = true; |
| 66 } | 66 } |
| 67 | 67 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 LiteralString jsCode = nativeBody.asLiteralString(); | 124 LiteralString jsCode = nativeBody.asLiteralString(); |
| 125 builder.push(new HForeignCode.statement( | 125 builder.push(new HForeignCode.statement( |
| 126 js.js.statementTemplateYielding( | 126 js.js.statementTemplateYielding( |
| 127 new js.LiteralStatement(jsCode.dartString.slowToString())), | 127 new js.LiteralStatement(jsCode.dartString.slowToString())), |
| 128 <HInstruction>[], | 128 <HInstruction>[], |
| 129 new SideEffects(), | 129 new SideEffects(), |
| 130 null, | 130 null, |
| 131 backend.dynamicType)); | 131 backend.dynamicType)); |
| 132 } | 132 } |
| 133 } | 133 } |
| OLD | NEW |