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

Unified Diff: third_party/pkg/angular/lib/tools/source_metadata_extractor.dart

Issue 180873006: Update the Angular/DI tests to latest from github. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review feedback Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/lib/tools/source_metadata_extractor.dart
diff --git a/third_party/pkg/angular/lib/tools/source_metadata_extractor.dart b/third_party/pkg/angular/lib/tools/source_metadata_extractor.dart
index e7a8d974d04a67051bb760ed1178fc2e720be797..ebe36844f4310f0c4befee126d5bfe851757a3b5 100644
--- a/third_party/pkg/angular/lib/tools/source_metadata_extractor.dart
+++ b/third_party/pkg/angular/lib/tools/source_metadata_extractor.dart
@@ -4,7 +4,6 @@ import 'package:analyzer/src/generated/ast.dart';
import 'package:angular/tools/source_crawler.dart';
import 'package:angular/tools/common.dart';
-import 'package:angular/utils.dart';
const String _COMPONENT = '-component';
const String _DIRECTIVE = '-directive';
@@ -20,16 +19,15 @@ const Map<String, String> _attrAnnotationsToSpec = const {
};
class SourceMetadataExtractor {
- SourceCrawler sourceCrawler;
DirectiveMetadataCollectingVisitor metadataVisitor;
- SourceMetadataExtractor(this.sourceCrawler, [ this.metadataVisitor ]) {
+ SourceMetadataExtractor([ this.metadataVisitor ]) {
if (metadataVisitor == null) {
metadataVisitor = new DirectiveMetadataCollectingVisitor();
}
}
- List<DirectiveInfo> gatherDirectiveInfo(root) {
+ List<DirectiveInfo> gatherDirectiveInfo(root, SourceCrawler sourceCrawler) {
sourceCrawler.crawl(root, metadataVisitor);
List<DirectiveInfo> directives = <DirectiveInfo>[];
@@ -42,13 +40,13 @@ class SourceMetadataExtractor {
.firstWhere((specPrefix) => mappingSpec.startsWith(specPrefix),
orElse: () => throw '$mappingSpec no matching spec');
if (spec != '@') {
- dirInfo.expressionAttrs.add(snakecase(attrName));
+ dirInfo.expressionAttrs.add(attrName);
}
if (mappingSpec.length == 1) { // Shorthand. Remove.
// TODO(pavelgj): Figure out if short-hand LHS should be expanded
// and added to the expressions list.
if (attrName != '.') {
- dirInfo.expressions.add(_maybeCamelCase(attrName));
+ dirInfo.expressions.add(attrName);
}
} else {
mappingSpec = mappingSpec.substring(spec.length);
@@ -60,7 +58,6 @@ class SourceMetadataExtractor {
});
meta.exportExpressionAttrs.forEach((attr) {
- attr = snakecase(attr);
if (!dirInfo.expressionAttrs.contains(attr)) {
dirInfo.expressionAttrs.add(attr);
}
@@ -74,7 +71,7 @@ class SourceMetadataExtractor {
// No explicit selector specified on the directive, compute one.
- var className = snakecase(meta.className);
+ var className = meta.className;
if (dirInfo.selector == null) {
if (meta.type == COMPONENT) {
if (className.endsWith(_COMPONENT)) {
@@ -93,8 +90,7 @@ class SourceMetadataExtractor {
dirInfo.selector = className.
substring(0, className.length - _DIRECTIVE.length);
} else {
- throw "Directive name '$className' must end with $_DIRECTIVE, "
- "$_ATTR_DIRECTIVE, $_COMPONENT or have a \$selector field.";
+ throw "Directive name '$className' must have a \$selector field.";
}
}
}
@@ -118,8 +114,6 @@ class SourceMetadataExtractor {
}
}
-String _maybeCamelCase(String s) => (s.indexOf('-') > -1) ? camelcase(s) : s;
-
class DirectiveMetadataCollectingVisitor {
List<DirectiveMetadata> metadata = <DirectiveMetadata>[];
« no previous file with comments | « third_party/pkg/angular/lib/tools/selector.dart ('k') | third_party/pkg/angular/lib/tools/template_cache_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698