OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of polymer; | 5 part of polymer; |
6 | 6 |
7 /** Annotation used to automatically register polymer elements. */ | 7 /** Annotation used to automatically register polymer elements. */ |
8 class CustomTag { | 8 class CustomTag { |
9 final String tagName; | 9 final String tagName; |
10 const CustomTag(this.tagName); | 10 const CustomTag(this.tagName); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 /** | 45 /** |
46 * Same as [initPolymer], but runs the version that is optimized for deployment | 46 * Same as [initPolymer], but runs the version that is optimized for deployment |
47 * to the internet. The biggest difference is it omits the [Zone] that | 47 * to the internet. The biggest difference is it omits the [Zone] that |
48 * automatically invokes [Observable.dirtyCheck], and the list of initializers | 48 * automatically invokes [Observable.dirtyCheck], and the list of initializers |
49 * must be supplied instead of being dynamically searched for at runtime using | 49 * must be supplied instead of being dynamically searched for at runtime using |
50 * mirrors. | 50 * mirrors. |
51 */ | 51 */ |
52 Zone initPolymerOptimized() { | 52 Zone initPolymerOptimized() { |
| 53 // TODO(sigmund): refactor this so we can replace it by codegen. |
| 54 smoke.useMirrors(); |
53 // TODO(jmesserly): there is some code in src/declaration/polymer-element.js, | 55 // TODO(jmesserly): there is some code in src/declaration/polymer-element.js, |
54 // git version 37eea00e13b9f86ab21c85a955585e8e4237e3d2, right before | 56 // git version 37eea00e13b9f86ab21c85a955585e8e4237e3d2, right before |
55 // it registers polymer-element, which uses Platform.deliverDeclarations to | 57 // it registers polymer-element, which uses Platform.deliverDeclarations to |
56 // coordinate with HTML Imports. I don't think we need it so skipping. | 58 // coordinate with HTML Imports. I don't think we need it so skipping. |
57 document.register(PolymerDeclaration._TAG, PolymerDeclaration); | 59 document.register(PolymerDeclaration._TAG, PolymerDeclaration); |
58 | 60 |
59 for (var initializer in _initializers) { | 61 for (var initializer in _initializers) { |
60 initializer(); | 62 initializer(); |
61 } | 63 } |
62 | 64 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 print("warning: methods marked with @initMethod should take no " | 240 print("warning: methods marked with @initMethod should take no " |
239 "arguments, ${method.simpleName} expects some."); | 241 "arguments, ${method.simpleName} expects some."); |
240 return; | 242 return; |
241 } | 243 } |
242 initializers.add(() => obj.invoke(method.simpleName, const [])); | 244 initializers.add(() => obj.invoke(method.simpleName, const [])); |
243 } | 245 } |
244 | 246 |
245 class _InitMethodAnnotation { | 247 class _InitMethodAnnotation { |
246 const _InitMethodAnnotation(); | 248 const _InitMethodAnnotation(); |
247 } | 249 } |
OLD | NEW |