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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 '${unusedClasses.length} native classes omitted.'); | 338 '${unusedClasses.length} native classes omitted.'); |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 void maybeEnableNative(Compiler compiler, | 342 void maybeEnableNative(Compiler compiler, |
343 LibraryElement library, | 343 LibraryElement library, |
344 Uri uri) { | 344 Uri uri) { |
345 String libraryName = uri.toString(); | 345 String libraryName = uri.toString(); |
346 if (library.entryCompilationUnit.script.name.contains( | 346 if (library.entryCompilationUnit.script.name.contains( |
347 'dart/tests/compiler/dart2js_native') | 347 'dart/tests/compiler/dart2js_native') |
| 348 || libraryName == 'dart:html_common' |
348 || libraryName == 'dart:isolate' | 349 || libraryName == 'dart:isolate' |
349 || libraryName == 'dart:html' | 350 || libraryName == 'dart:html' |
350 || libraryName == 'dart:svg') { | 351 || libraryName == 'dart:svg') { |
351 library.canUseNative = true; | 352 library.canUseNative = true; |
352 } | 353 } |
353 } | 354 } |
354 | 355 |
355 /** | 356 /** |
356 * A summary of the behavior of a native element. | 357 * A summary of the behavior of a native element. |
357 * | 358 * |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 String parameters) { | 836 String parameters) { |
836 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty"); | 837 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty"); |
837 buffer.add("('$methodName')) {\n"); | 838 buffer.add("('$methodName')) {\n"); |
838 buffer.add(" $code"); | 839 buffer.add(" $code"); |
839 buffer.add(" } else {\n"); | 840 buffer.add(" } else {\n"); |
840 buffer.add(" return Object.prototype.$methodName.call(this"); | 841 buffer.add(" return Object.prototype.$methodName.call(this"); |
841 buffer.add(parameters == '' ? '' : ', $parameters'); | 842 buffer.add(parameters == '' ? '' : ', $parameters'); |
842 buffer.add(");\n"); | 843 buffer.add(");\n"); |
843 buffer.add(" }\n"); | 844 buffer.add(" }\n"); |
844 } | 845 } |
OLD | NEW |