| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 lib = canonicalLib; | 162 lib = canonicalLib; |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 if (lib == null) { | 166 if (lib == null) { |
| 167 print('warning: $uri library not found'); | 167 print('warning: $uri library not found'); |
| 168 return; | 168 return; |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Search top-level functions marked with @initMethod | 171 // Search top-level functions marked with @initMethod |
| 172 for (var f in lib.declarations.values.where((d) => d is MethodMirror)) { | 172 for (var f in lib.functions.values) { |
| 173 _maybeInvoke(lib, f); | 173 _maybeInvoke(lib, f); |
| 174 } | 174 } |
| 175 | 175 |
| 176 for (var c in lib.declarations.values.where((d) => d is ClassMirror)) { | 176 for (var c in lib.classes.values) { |
| 177 // Search for @CustomTag on classes | 177 // Search for @CustomTag on classes |
| 178 for (var m in c.metadata) { | 178 for (var m in c.metadata) { |
| 179 var meta = m.reflectee; | 179 var meta = m.reflectee; |
| 180 if (meta is CustomTag) { | 180 if (meta is CustomTag) { |
| 181 Polymer.register(meta.tagName, getReflectedTypeWorkaround(c)); | 181 Polymer.register(meta.tagName, getReflectedTypeWorkaround(c)); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 // TODO(sigmund): check also static methods marked with @initMethod. | 185 // TODO(sigmund): check also static methods marked with @initMethod. |
| 186 // This is blocked on two bugs: | 186 // This is blocked on two bugs: |
| (...skipping 22 matching lines...) Expand all Loading... |
| 209 print("warning: methods marked with @initMethod should take no " | 209 print("warning: methods marked with @initMethod should take no " |
| 210 "arguments, ${method.simpleName} expects some."); | 210 "arguments, ${method.simpleName} expects some."); |
| 211 return; | 211 return; |
| 212 } | 212 } |
| 213 obj.invoke(method.simpleName, const []); | 213 obj.invoke(method.simpleName, const []); |
| 214 } | 214 } |
| 215 | 215 |
| 216 class _InitMethodAnnotation { | 216 class _InitMethodAnnotation { |
| 217 const _InitMethodAnnotation(); | 217 const _InitMethodAnnotation(); |
| 218 } | 218 } |
| OLD | NEW |