| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 ClassElement _annotationCreatesClass; | 113 ClassElement _annotationCreatesClass; |
| 114 ClassElement _annotationReturnsClass; | 114 ClassElement _annotationReturnsClass; |
| 115 ClassElement _annotationJsNameClass; | 115 ClassElement _annotationJsNameClass; |
| 116 | 116 |
| 117 /// Subclasses of [NativeEnqueuerBase] are constructed by the backend. | 117 /// Subclasses of [NativeEnqueuerBase] are constructed by the backend. |
| 118 NativeEnqueuerBase(this.world, this.compiler, this.enableLiveTypeAnalysis); | 118 NativeEnqueuerBase(this.world, this.compiler, this.enableLiveTypeAnalysis); |
| 119 | 119 |
| 120 void processNativeClasses(Iterable<LibraryElement> libraries) { | 120 void processNativeClasses(Iterable<LibraryElement> libraries) { |
| 121 libraries.forEach(processNativeClassesInLibrary); | 121 libraries.forEach(processNativeClassesInLibrary); |
| 122 processNativeClassesInLibrary(compiler.isolateHelperLibrary); | 122 if (compiler.isolateHelperLibrary != null) { |
| 123 | 123 processNativeClassesInLibrary(compiler.isolateHelperLibrary); |
| 124 } |
| 124 processSubclassesOfNativeClasses(libraries); | 125 processSubclassesOfNativeClasses(libraries); |
| 125 | |
| 126 if (!enableLiveTypeAnalysis) { | 126 if (!enableLiveTypeAnalysis) { |
| 127 nativeClasses.forEach((c) => enqueueClass(c, 'forced')); | 127 nativeClasses.forEach((c) => enqueueClass(c, 'forced')); |
| 128 flushQueue(); | 128 flushQueue(); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 void processNativeClassesInLibrary(LibraryElement library) { | 132 void processNativeClassesInLibrary(LibraryElement library) { |
| 133 // Use implementation to ensure the inclusion of injected members. | 133 // Use implementation to ensure the inclusion of injected members. |
| 134 library.implementation.forEachLocalMember((Element element) { | 134 library.implementation.forEachLocalMember((Element element) { |
| 135 if (element.isClass() && element.isNative()) { | 135 if (element.isClass() && element.isNative()) { |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 'native "..." syntax is restricted to functions with zero parameters', | 1143 'native "..." syntax is restricted to functions with zero parameters', |
| 1144 node: nativeBody); | 1144 node: nativeBody); |
| 1145 } | 1145 } |
| 1146 LiteralString jsCode = nativeBody.asLiteralString(); | 1146 LiteralString jsCode = nativeBody.asLiteralString(); |
| 1147 builder.push(new HForeign.statement( | 1147 builder.push(new HForeign.statement( |
| 1148 new js.LiteralStatement(jsCode.dartString.slowToString()), | 1148 new js.LiteralStatement(jsCode.dartString.slowToString()), |
| 1149 <HInstruction>[], | 1149 <HInstruction>[], |
| 1150 new SideEffects())); | 1150 new SideEffects())); |
| 1151 } | 1151 } |
| 1152 } | 1152 } |
| OLD | NEW |