| 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 | 6 |
| 7 import 'dart:uri'; | 7 import 'dart:uri'; |
| 8 import 'dart2jslib.dart' hide SourceString; | 8 import 'dart2jslib.dart' hide SourceString; |
| 9 import 'elements/elements.dart'; | 9 import 'elements/elements.dart'; |
| 10 import 'js_backend/js_backend.dart'; | 10 import 'js_backend/js_backend.dart'; |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 '${unusedClasses.length} native classes omitted.'); | 348 '${unusedClasses.length} native classes omitted.'); |
| 349 } | 349 } |
| 350 } | 350 } |
| 351 | 351 |
| 352 void maybeEnableNative(Compiler compiler, | 352 void maybeEnableNative(Compiler compiler, |
| 353 LibraryElement library, | 353 LibraryElement library, |
| 354 Uri uri) { | 354 Uri uri) { |
| 355 String libraryName = uri.toString(); | 355 String libraryName = uri.toString(); |
| 356 if (library.entryCompilationUnit.script.name.contains( | 356 if (library.entryCompilationUnit.script.name.contains( |
| 357 'dart/tests/compiler/dart2js_native') | 357 'dart/tests/compiler/dart2js_native') |
| 358 || libraryName == 'dart:html_common' |
| 358 || libraryName == 'dart:isolate' | 359 || libraryName == 'dart:isolate' |
| 359 || libraryName == 'dart:html' | 360 || libraryName == 'dart:html' |
| 360 || libraryName == 'dart:svg' | 361 || libraryName == 'dart:svg' |
| 361 || libraryName == 'dart:web_audio') { | 362 || libraryName == 'dart:web_audio') { |
| 362 library.canUseNative = true; | 363 library.canUseNative = true; |
| 363 } | 364 } |
| 364 } | 365 } |
| 365 | 366 |
| 366 /** | 367 /** |
| 367 * A summary of the behavior of a native element. | 368 * A summary of the behavior of a native element. |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 builder.add(new HForeign( | 803 builder.add(new HForeign( |
| 803 new DartString.literal('${parameter.name.slowToString()} = #'), | 804 new DartString.literal('${parameter.name.slowToString()} = #'), |
| 804 const LiteralDartString('void'), | 805 const LiteralDartString('void'), |
| 805 <HInstruction>[jsClosure])); | 806 <HInstruction>[jsClosure])); |
| 806 } | 807 } |
| 807 }); | 808 }); |
| 808 LiteralString jsCode = nativeBody.asLiteralString(); | 809 LiteralString jsCode = nativeBody.asLiteralString(); |
| 809 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); | 810 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); |
| 810 } | 811 } |
| 811 } | 812 } |
| OLD | NEW |