| 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 /** | 5 /** |
| 6 * Datatypes holding information extracted by the analyzer and used by later | 6 * Datatypes holding information extracted by the analyzer and used by later |
| 7 * phases of the compiler. | 7 * phases of the compiler. |
| 8 */ | 8 */ |
| 9 library polymer.src.info; | 9 library polymer.src.info; |
| 10 | 10 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 */ | 186 */ |
| 187 ComponentSummary extendsComponent; | 187 ComponentSummary extendsComponent; |
| 188 | 188 |
| 189 /** The Dart class containing the component's behavior. */ | 189 /** The Dart class containing the component's behavior. */ |
| 190 String className; | 190 String className; |
| 191 | 191 |
| 192 /** The Dart class declaration. */ | 192 /** The Dart class declaration. */ |
| 193 ClassDeclaration get classDeclaration => _classDeclaration; | 193 ClassDeclaration get classDeclaration => _classDeclaration; |
| 194 ClassDeclaration _classDeclaration; | 194 ClassDeclaration _classDeclaration; |
| 195 | 195 |
| 196 /** Component's <element> element. */ | |
| 197 Element elementNode; | |
| 198 | |
| 199 // TODO(terry): Remove once we stop mangling CSS selectors. | 196 // TODO(terry): Remove once we stop mangling CSS selectors. |
| 200 /** CSS selectors scoped. */ | 197 /** CSS selectors scoped. */ |
| 201 bool scoped = false; | 198 bool scoped = false; |
| 202 | 199 |
| 203 /** The declaring `<element>` tag. */ | 200 /** The declaring `<element>` tag. */ |
| 204 final Node element; | 201 final Node element; |
| 205 | 202 |
| 206 /** File where this component was defined. */ | 203 /** File where this component was defined. */ |
| 207 UrlInfo get dartCodeUrl => externalFile != null | 204 UrlInfo get dartCodeUrl => externalFile != null |
| 208 ? externalFile : declaringFile.inputUrl; | 205 ? externalFile : declaringFile.inputUrl; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 236 */ | 233 */ |
| 237 void findClassDeclaration(Messages messages) { | 234 void findClassDeclaration(Messages messages) { |
| 238 var constructor = element.attributes['constructor']; | 235 var constructor = element.attributes['constructor']; |
| 239 className = constructor != null ? constructor : | 236 className = constructor != null ? constructor : |
| 240 toCamelCase(tagName, startUppercase: true); | 237 toCamelCase(tagName, startUppercase: true); |
| 241 | 238 |
| 242 // If we don't have any code, generate a small class definition, and | 239 // If we don't have any code, generate a small class definition, and |
| 243 // pretend the user wrote it as inlined code. | 240 // pretend the user wrote it as inlined code. |
| 244 if (userCode == null) { | 241 if (userCode == null) { |
| 245 var superclass = extendsComponent != null ? extendsComponent.className | 242 var superclass = extendsComponent != null ? extendsComponent.className |
| 246 : 'autogenerated.WebComponent'; | 243 : 'autogenerated.PolymerElement'; |
| 247 inlinedCode = new DartCodeInfo(null, null, [], | 244 inlinedCode = new DartCodeInfo(null, null, [], |
| 248 'class $className extends $superclass {\n}', null); | 245 'class $className extends $superclass {\n}', null); |
| 249 } | 246 } |
| 250 | 247 |
| 251 var code = userCode.code; | 248 var code = userCode.code; |
| 252 _classDeclaration = userCode.findClass(className); | 249 _classDeclaration = userCode.findClass(className); |
| 253 if (_classDeclaration == null) { | 250 if (_classDeclaration == null) { |
| 254 // Check for deprecated x-tags implied constructor. | 251 // Check for deprecated x-tags implied constructor. |
| 255 if (tagName.startsWith('x-') && constructor == null) { | 252 if (tagName.startsWith('x-') && constructor == null) { |
| 256 var oldCtor = toCamelCase(tagName.substring(2), startUppercase: true); | 253 var oldCtor = toCamelCase(tagName.substring(2), startUppercase: true); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 return new UrlInfo(url, target, span); | 327 return new UrlInfo(url, target, span); |
| 331 } | 328 } |
| 332 | 329 |
| 333 bool operator ==(UrlInfo other) => | 330 bool operator ==(UrlInfo other) => |
| 334 url == other.url && resolvedPath == other.resolvedPath; | 331 url == other.url && resolvedPath == other.resolvedPath; |
| 335 | 332 |
| 336 int get hashCode => resolvedPath.hashCode; | 333 int get hashCode => resolvedPath.hashCode; |
| 337 | 334 |
| 338 String toString() => "#<UrlInfo url: $url, resolvedPath: $resolvedPath>"; | 335 String toString() => "#<UrlInfo url: $url, resolvedPath: $resolvedPath>"; |
| 339 } | 336 } |
| OLD | NEW |