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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 if (uri.scheme == '' && srcUrl != null) { | 69 if (uri.scheme == '' && srcUrl != null) { |
70 uri = Uri.parse(path.normalize(path.join(path.dirname(srcUrl), uriString))); | 70 uri = Uri.parse(path.normalize(path.join(path.dirname(srcUrl), uriString))); |
71 } | 71 } |
72 var lib = _libs[uri]; | 72 var lib = _libs[uri]; |
73 if (lib == null) { | 73 if (lib == null) { |
74 print('warning: $uri library not found'); | 74 print('warning: $uri library not found'); |
75 return; | 75 return; |
76 } | 76 } |
77 | 77 |
78 // Invoke `main`, if present. | 78 // Invoke `main`, if present. |
79 if (lib.functions[const Symbol('main')] != null) { | 79 if (lib.functions[#main] != null) { |
80 lib.invoke(const Symbol('main'), const []); | 80 lib.invoke(#main, const []); |
81 } | 81 } |
82 | 82 |
83 // Search top-level functions marked with @initMethod | 83 // Search top-level functions marked with @initMethod |
84 for (var f in lib.functions.values) { | 84 for (var f in lib.functions.values) { |
85 _maybeInvoke(lib, f); | 85 _maybeInvoke(lib, f); |
86 } | 86 } |
87 | 87 |
88 for (var c in lib.classes.values) { | 88 for (var c in lib.classes.values) { |
89 // Search for @CustomTag on classes | 89 // Search for @CustomTag on classes |
90 for (var m in c.metadata) { | 90 for (var m in c.metadata) { |
(...skipping 30 matching lines...) Expand all Loading... |
121 print("warning: methods marked with @initMethod should take no " | 121 print("warning: methods marked with @initMethod should take no " |
122 "arguments, ${method.simpleName} expects some."); | 122 "arguments, ${method.simpleName} expects some."); |
123 return; | 123 return; |
124 } | 124 } |
125 obj.invoke(method.simpleName, const []); | 125 obj.invoke(method.simpleName, const []); |
126 } | 126 } |
127 | 127 |
128 class _InitMethodAnnotation { | 128 class _InitMethodAnnotation { |
129 const _InitMethodAnnotation(); | 129 const _InitMethodAnnotation(); |
130 } | 130 } |
OLD | NEW |