| 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 library web_components.build.html_import_recorder_inliner; | 4 library web_components.build.html_import_recorder_inliner; |
| 5 | 5 |
| 6 import 'package:analyzer/analyzer.dart'; | 6 import 'package:analyzer/analyzer.dart'; |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:barback/barback.dart'; | 9 import 'package:barback/barback.dart'; |
| 10 import 'package:initialize/transformer.dart'; | 10 import 'package:initialize/transformer.dart'; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 var logger = pluginData.logger; | 54 var logger = pluginData.logger; |
| 55 var annotation = pluginData.initializer.annotationNode; | 55 var annotation = pluginData.initializer.annotationNode; |
| 56 var annotationElement = pluginData.initializer.annotationElement; | 56 var annotationElement = pluginData.initializer.annotationElement; |
| 57 var element = pluginData.initializer.targetElement as LibraryElement; | 57 var element = pluginData.initializer.targetElement as LibraryElement; |
| 58 var resolver = pluginData.resolver; | 58 var resolver = pluginData.resolver; |
| 59 var libraryDirective = | 59 var libraryDirective = |
| 60 pluginData.initializer.targetNode.parent.parent as LibraryDirective; | 60 pluginData.initializer.targetNode.parent.parent as LibraryDirective; |
| 61 | 61 |
| 62 var originalImportPath; | 62 var originalImportPath; |
| 63 if (annotationElement.element is PropertyAccessorElement) { | 63 if (annotationElement.element is PropertyAccessorElement) { |
| 64 originalImportPath = resolver.evaluateConstant(element.library, | 64 originalImportPath = resolver.evaluateConstant( |
| 65 annotation.name).value.fields['filePath'].stringValue; | 65 element.library, annotation.name).value.fields[ |
| 66 'filePath'].stringValue; |
| 66 } else { | 67 } else { |
| 67 assert(annotationElement.element is ConstructorElement); | 68 assert(annotationElement.element is ConstructorElement); |
| 68 originalImportPath = resolver.evaluateConstant(element.library, | 69 originalImportPath = resolver.evaluateConstant(element.library, |
| 69 annotation.arguments.arguments.first).value.stringValue; | 70 annotation.arguments.arguments.first).value.stringValue; |
| 70 } | 71 } |
| 71 | 72 |
| 72 var libPath; | 73 var libPath; |
| 73 var segments = element.source.uri.pathSegments; | 74 var segments = element.source.uri.pathSegments; |
| 74 var package = segments[0]; | 75 var package = segments[0]; |
| 75 if (bootstrapId.package == package && | 76 if (bootstrapId.package == package && |
| (...skipping 10 matching lines...) Expand all Loading... |
| 86 return null; | 87 return null; |
| 87 } | 88 } |
| 88 | 89 |
| 89 importPaths | 90 importPaths |
| 90 .add(normalizeHtmlImportPath(originalImportPath, package, libPath)); | 91 .add(normalizeHtmlImportPath(originalImportPath, package, libPath)); |
| 91 | 92 |
| 92 // Don't emit an InitEntry. | 93 // Don't emit an InitEntry. |
| 93 return null; | 94 return null; |
| 94 } | 95 } |
| 95 } | 96 } |
| OLD | NEW |