| 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 class NativeEmitter { | 7 class NativeEmitter { |
| 8 | 8 |
| 9 CodeEmitterTask emitter; | 9 CodeEmitterTask emitter; |
| 10 CodeBuffer nativeBuffer; | 10 CodeBuffer nativeBuffer; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 arguments = argumentsBuffer.sublist(0, | 436 arguments = argumentsBuffer.sublist(0, |
| 437 indexOfLastOptionalArgumentInParameters + 1); | 437 indexOfLastOptionalArgumentInParameters + 1); |
| 438 } | 438 } |
| 439 statements.add(new jsAst.Return(receiver[target](arguments))); | 439 statements.add(new jsAst.Return(receiver[target](arguments))); |
| 440 | 440 |
| 441 return statements; | 441 return statements; |
| 442 } | 442 } |
| 443 | 443 |
| 444 bool isSupertypeOfNativeClass(Element element) { | 444 bool isSupertypeOfNativeClass(Element element) { |
| 445 if (element.isTypeVariable()) { | 445 if (element.isTypeVariable()) { |
| 446 compiler.cancel("Is check for type variable", element: element); | 446 compiler.internalError(element, "Is check for type variable."); |
| 447 return false; | 447 return false; |
| 448 } | 448 } |
| 449 if (element.computeType(compiler).unalias(compiler) is FunctionType) { | 449 if (element.computeType(compiler).unalias(compiler) is FunctionType) { |
| 450 // The element type is a function type either directly or through | 450 // The element type is a function type either directly or through |
| 451 // typedef(s). | 451 // typedef(s). |
| 452 return false; | 452 return false; |
| 453 } | 453 } |
| 454 | 454 |
| 455 if (!element.isClass()) { | 455 if (!element.isClass()) { |
| 456 compiler.cancel("Is check does not handle element", element: element); | 456 compiler.internalError(element, "Is check does not handle element."); |
| 457 return false; | 457 return false; |
| 458 } | 458 } |
| 459 | 459 |
| 460 if (backend.classesMixedIntoInterceptedClasses.contains(element)) { | 460 if (backend.classesMixedIntoInterceptedClasses.contains(element)) { |
| 461 return true; | 461 return true; |
| 462 } | 462 } |
| 463 | 463 |
| 464 return subtypes[element] != null; | 464 return subtypes[element] != null; |
| 465 } | 465 } |
| 466 | 466 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 if (emitter.compiler.enableMinification) targetBuffer.add(';'); | 510 if (emitter.compiler.enableMinification) targetBuffer.add(';'); |
| 511 targetBuffer.add(jsAst.prettyPrint( | 511 targetBuffer.add(jsAst.prettyPrint( |
| 512 new jsAst.ExpressionStatement(init), compiler)); | 512 new jsAst.ExpressionStatement(init), compiler)); |
| 513 targetBuffer.add('\n'); | 513 targetBuffer.add('\n'); |
| 514 } | 514 } |
| 515 | 515 |
| 516 targetBuffer.add(nativeBuffer); | 516 targetBuffer.add(nativeBuffer); |
| 517 targetBuffer.add('\n'); | 517 targetBuffer.add('\n'); |
| 518 } | 518 } |
| 519 } | 519 } |
| OLD | NEW |