| 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'; |
| 11 import 'js_backend/js_backend.dart'; | 11 import 'js_backend/js_backend.dart'; |
| 12 import 'resolution/resolution.dart' show ResolverVisitor; | 12 import 'resolution/resolution.dart' show ResolverVisitor; |
| 13 import 'scanner/scannerlib.dart'; | 13 import 'scanner/scannerlib.dart'; |
| 14 import 'ssa/ssa.dart'; | 14 import 'ssa/ssa.dart'; |
| 15 import 'tree/tree.dart'; | 15 import 'tree/tree.dart'; |
| 16 import 'universe/universe.dart' show SideEffects; | 16 import 'universe/universe.dart' show SideEffects; |
| 17 import 'util/util.dart'; | 17 import 'util/util.dart'; |
| 18 import 'js/js.dart' as js; | 18 import 'js/js.dart' as js; |
| 19 | 19 |
| 20 | 20 |
| 21 /// This class is a temporary work-around until we get a more powerful DartType. | 21 /// This class is a temporary work-around until we get a more powerful DartType. |
| 22 class SpecialType { | 22 class SpecialType { |
| 23 final String name; | 23 final String name; |
| 24 const SpecialType._(this.name); | 24 const SpecialType._(this.name); |
| 25 | 25 |
| 26 /// The type Object, but no subtypes: | 26 /// The type Object, but no subtypes: |
| 27 static const JsObject = const SpecialType._('=Object'); | 27 static const JsObject = const SpecialType._('=Object'); |
| 28 |
| 29 int get hashCode => name.hashCode; |
| 28 } | 30 } |
| 29 | 31 |
| 30 | |
| 31 /** | 32 /** |
| 32 * This could be an abstract class but we use it as a stub for the dart_backend. | 33 * This could be an abstract class but we use it as a stub for the dart_backend. |
| 33 */ | 34 */ |
| 34 class NativeEnqueuer { | 35 class NativeEnqueuer { |
| 35 /// Initial entry point to native enqueuer. | 36 /// Initial entry point to native enqueuer. |
| 36 void processNativeClasses(Iterable<LibraryElement> libraries) {} | 37 void processNativeClasses(Iterable<LibraryElement> libraries) {} |
| 37 | 38 |
| 38 /// Notification of a main Enqueuer worklist element. For methods, adds | 39 /// Notification of a main Enqueuer worklist element. For methods, adds |
| 39 /// information from metadata attributes, and computes types instantiated due | 40 /// information from metadata attributes, and computes types instantiated due |
| 40 /// to calling the method. | 41 /// to calling the method. |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 'native "..." syntax is restricted to functions with zero parameters', | 1015 'native "..." syntax is restricted to functions with zero parameters', |
| 1015 node: nativeBody); | 1016 node: nativeBody); |
| 1016 } | 1017 } |
| 1017 LiteralString jsCode = nativeBody.asLiteralString(); | 1018 LiteralString jsCode = nativeBody.asLiteralString(); |
| 1018 builder.push(new HForeign.statement( | 1019 builder.push(new HForeign.statement( |
| 1019 new js.LiteralStatement(jsCode.dartString.slowToString()), | 1020 new js.LiteralStatement(jsCode.dartString.slowToString()), |
| 1020 <HInstruction>[], | 1021 <HInstruction>[], |
| 1021 new SideEffects())); | 1022 new SideEffects())); |
| 1022 } | 1023 } |
| 1023 } | 1024 } |
| OLD | NEW |