| 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 dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 class NativeEmitter { | 7 class NativeEmitter { |
| 8 | 8 |
| 9 final Map<Element, ClassBuilder> cachedBuilders; | 9 final Map<Element, ClassBuilder> cachedBuilders; |
| 10 | 10 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 int indexOfLastOptionalArgumentInParameters) { | 307 int indexOfLastOptionalArgumentInParameters) { |
| 308 // The target JS function may check arguments.length so we need to | 308 // The target JS function may check arguments.length so we need to |
| 309 // make sure not to pass any unspecified optional arguments to it. | 309 // make sure not to pass any unspecified optional arguments to it. |
| 310 // For example, for the following Dart method: | 310 // For example, for the following Dart method: |
| 311 // foo([x, y, z]); | 311 // foo([x, y, z]); |
| 312 // The call: | 312 // The call: |
| 313 // foo(y: 1) | 313 // foo(y: 1) |
| 314 // must be turned into a JS call to: | 314 // must be turned into a JS call to: |
| 315 // foo(null, y). | 315 // foo(null, y). |
| 316 | 316 |
| 317 ClassElement classElement = member.enclosingClass; | |
| 318 | |
| 319 List<jsAst.Statement> statements = <jsAst.Statement>[]; | 317 List<jsAst.Statement> statements = <jsAst.Statement>[]; |
| 320 potentiallyConvertDartClosuresToJs(statements, member, stubParameters); | 318 potentiallyConvertDartClosuresToJs(statements, member, stubParameters); |
| 321 | 319 |
| 322 String target; | 320 String target; |
| 323 jsAst.Expression receiver; | 321 jsAst.Expression receiver; |
| 324 List<jsAst.Expression> arguments; | 322 List<jsAst.Expression> arguments; |
| 325 | 323 |
| 326 assert(invariant(member, nativeMethods.contains(member))); | 324 assert(invariant(member, nativeMethods.contains(member))); |
| 327 // When calling a JS method, we call it with the native name, and only the | 325 // When calling a JS method, we call it with the native name, and only the |
| 328 // arguments up until the last one provided. | 326 // arguments up until the last one provided. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 } | 464 } |
| 467 ''', {'info': infoAccess, | 465 ''', {'info': infoAccess, |
| 468 'constructor': constructorAccess, | 466 'constructor': constructorAccess, |
| 469 'subclassRead': subclassRead, | 467 'subclassRead': subclassRead, |
| 470 'interceptorsByTagAccess': interceptorsByTagAccess, | 468 'interceptorsByTagAccess': interceptorsByTagAccess, |
| 471 'leafTagsAccess': leafTagsAccess, | 469 'leafTagsAccess': leafTagsAccess, |
| 472 'nativeSuperclassTagName': embeddedNames.NATIVE_SUPERCLASS_TAG_NAME, | 470 'nativeSuperclassTagName': embeddedNames.NATIVE_SUPERCLASS_TAG_NAME, |
| 473 'allowNativesSubclassing': true}); | 471 'allowNativesSubclassing': true}); |
| 474 } | 472 } |
| 475 } | 473 } |
| OLD | NEW |