| 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:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 import 'dart2jslib.dart' hide SourceString; | 8 import 'dart2jslib.dart' hide SourceString; |
| 9 import 'dart_types.dart'; | 9 import 'dart_types.dart'; |
| 10 import 'elements/elements.dart'; | 10 import 'elements/elements.dart'; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 ClassElement _annotationCreatesClass; | 108 ClassElement _annotationCreatesClass; |
| 109 ClassElement _annotationReturnsClass; | 109 ClassElement _annotationReturnsClass; |
| 110 ClassElement _annotationJsNameClass; | 110 ClassElement _annotationJsNameClass; |
| 111 | 111 |
| 112 /// Subclasses of [NativeEnqueuerBase] are constructed by the backend. | 112 /// Subclasses of [NativeEnqueuerBase] are constructed by the backend. |
| 113 NativeEnqueuerBase(this.world, this.compiler, this.enableLiveTypeAnalysis); | 113 NativeEnqueuerBase(this.world, this.compiler, this.enableLiveTypeAnalysis); |
| 114 | 114 |
| 115 void processNativeClasses(Iterable<LibraryElement> libraries) { | 115 void processNativeClasses(Iterable<LibraryElement> libraries) { |
| 116 libraries.forEach(processNativeClassesInLibrary); | 116 libraries.forEach(processNativeClassesInLibrary); |
| 117 processNativeClassesInLibrary(compiler.isolateHelperLibrary); | 117 if (compiler.isolateHelperLibrary != null) { |
| 118 processNativeClassesInLibrary(compiler.isolateHelperLibrary); |
| 119 } |
| 118 if (!enableLiveTypeAnalysis) { | 120 if (!enableLiveTypeAnalysis) { |
| 119 nativeClasses.forEach((c) => enqueueClass(c, 'forced')); | 121 nativeClasses.forEach((c) => enqueueClass(c, 'forced')); |
| 120 flushQueue(); | 122 flushQueue(); |
| 121 } | 123 } |
| 122 } | 124 } |
| 123 | 125 |
| 124 void processNativeClassesInLibrary(LibraryElement library) { | 126 void processNativeClassesInLibrary(LibraryElement library) { |
| 125 // Use implementation to ensure the inclusion of injected members. | 127 // Use implementation to ensure the inclusion of injected members. |
| 126 library.implementation.forEachLocalMember((Element element) { | 128 library.implementation.forEachLocalMember((Element element) { |
| 127 if (element.isClass() && element.isNative()) { | 129 if (element.isClass() && element.isNative()) { |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 'native "..." syntax is restricted to functions with zero parameters', | 1018 'native "..." syntax is restricted to functions with zero parameters', |
| 1017 node: nativeBody); | 1019 node: nativeBody); |
| 1018 } | 1020 } |
| 1019 LiteralString jsCode = nativeBody.asLiteralString(); | 1021 LiteralString jsCode = nativeBody.asLiteralString(); |
| 1020 builder.push(new HForeign.statement( | 1022 builder.push(new HForeign.statement( |
| 1021 new js.LiteralStatement(jsCode.dartString.slowToString()), | 1023 new js.LiteralStatement(jsCode.dartString.slowToString()), |
| 1022 <HInstruction>[], | 1024 <HInstruction>[], |
| 1023 new SideEffects())); | 1025 new SideEffects())); |
| 1024 } | 1026 } |
| 1025 } | 1027 } |
| OLD | NEW |