| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dev_compiler.src.codegen.js_codegen; | 5 library dev_compiler.src.codegen.js_codegen; |
| 6 | 6 |
| 7 import 'dart:collection' show HashSet, HashMap; | 7 import 'dart:collection' show HashSet, HashMap; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
| 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; | 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // the native JS type eagerly at this point. | 350 // the native JS type eagerly at this point. |
| 351 // If we wanted to support laziness, we could defer the hookup until | 351 // If we wanted to support laziness, we could defer the hookup until |
| 352 // the end of the Dart library cycle load. | 352 // the end of the Dart library cycle load. |
| 353 assert(!_lazyClass(type)); | 353 assert(!_lazyClass(type)); |
| 354 | 354 |
| 355 // TODO(jmesserly): this copies the dynamic members. | 355 // TODO(jmesserly): this copies the dynamic members. |
| 356 // Probably fine for objects coming from JS, but not if we actually | 356 // Probably fine for objects coming from JS, but not if we actually |
| 357 // want to support construction of instances with generic types other | 357 // want to support construction of instances with generic types other |
| 358 // than dynamic. See issue #154 for Array and List<E> related bug. | 358 // than dynamic. See issue #154 for Array and List<E> related bug. |
| 359 var copyMembers = js.statement( | 359 var copyMembers = js.statement( |
| 360 'dart.copyProperties(dart.global.#.prototype, #.prototype);', [ | 360 'dart.registerExtension(dart.global.#, #);', [ |
| 361 _propertyName(jsPeerName), | 361 _propertyName(jsPeerName), |
| 362 classElem.name | 362 classElem.name |
| 363 ]); | 363 ]); |
| 364 return _statement([result, copyMembers]); | 364 return _statement([result, copyMembers]); |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 return result; | 367 return result; |
| 368 } | 368 } |
| 369 | 369 |
| 370 @override | 370 @override |
| (...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2469 // TODO(jmesserly): validate the library. See issue #135. | 2469 // TODO(jmesserly): validate the library. See issue #135. |
| 2470 bool _isJsNameAnnotation(DartObjectImpl value) => value.type.name == 'JsName'; | 2470 bool _isJsNameAnnotation(DartObjectImpl value) => value.type.name == 'JsName'; |
| 2471 | 2471 |
| 2472 bool _isJsPeerInterface(DartObjectImpl value) => | 2472 bool _isJsPeerInterface(DartObjectImpl value) => |
| 2473 value.type.name == 'JsPeerInterface'; | 2473 value.type.name == 'JsPeerInterface'; |
| 2474 | 2474 |
| 2475 // TODO(jacobr): we would like to do something like the following | 2475 // TODO(jacobr): we would like to do something like the following |
| 2476 // but we don't have summary support yet. | 2476 // but we don't have summary support yet. |
| 2477 // bool _supportJsExtensionMethod(AnnotatedNode node) => | 2477 // bool _supportJsExtensionMethod(AnnotatedNode node) => |
| 2478 // _getAnnotation(node, "SupportJsExtensionMethod") != null; | 2478 // _getAnnotation(node, "SupportJsExtensionMethod") != null; |
| OLD | NEW |