Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: lib/build/html_import_annotation_recorder.dart

Issue 997193004: update analyzer and code_transformers version and use mock sdk from code transformers (Closed) Base URL: git@github.com:dart-lang/web-components.git@master
Patch Set: update changelog Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « CHANGELOG.md ('k') | lib/build/web_components.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 27
28 /// Applies to anything named `HtmlImport` which annotates a library. 28 /// Applies to anything named `HtmlImport` which annotates a library.
29 bool shouldApply(InitializerPluginData pluginData) { 29 bool shouldApply(InitializerPluginData pluginData) {
30 var annotationElement = pluginData.initializer.annotationNode.element; 30 var annotationElement = pluginData.initializer.annotationNode.element;
31 var logger = pluginData.logger; 31 var logger = pluginData.logger;
32 DartType type; 32 DartType type;
33 if (annotationElement is ConstructorElement) { 33 if (annotationElement is ConstructorElement) {
34 type = annotationElement.returnType; 34 type = annotationElement.returnType;
35 } else if (annotationElement is PropertyAccessorElement) { 35 } else if (annotationElement is PropertyAccessorElement) {
36 type = annotationElement.variable.propagatedType; 36 type = annotationElement.variable.propagatedType;
37 if (type == null) {
38 type = pluginData.resolver.evaluateConstant(annotationElement.library,
39 pluginData.initializer.annotationNode.name).value.type;
40 }
37 } else { 41 } else {
38 logger.error('Unsupported annotation type. Only constructors and ' 42 logger.error('Unsupported annotation type. Only constructors and '
39 'properties are supported as initializers.'); 43 'properties are supported as initializers.');
40 return false; 44 return false;
41 } 45 }
42 if (type.name != 'HtmlImport') return false; 46 if (type.name != 'HtmlImport') return false;
43 if (pluginData.initializer.targetElement is! LibraryElement) { 47 if (pluginData.initializer.targetElement is! LibraryElement) {
44 logger.error('Invalid HtmlImport annotation on non-library element.'); 48 logger.error('Invalid HtmlImport annotation on non-library element.');
45 return false; 49 return false;
46 } 50 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 return null; 91 return null;
88 } 92 }
89 93
90 importPaths 94 importPaths
91 .add(normalizeHtmlImportPath(originalImportPath, package, libPath)); 95 .add(normalizeHtmlImportPath(originalImportPath, package, libPath));
92 96
93 // Don't emit an InitEntry. 97 // Don't emit an InitEntry.
94 return null; 98 return null;
95 } 99 }
96 } 100 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/build/web_components.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698