chore(rename): rename View and Template concepts for #1244
This commit is contained in:

committed by
Jeremy Elbourn

parent
564477b8a0
commit
bf7933714a
@ -17,7 +17,7 @@ class ExtractSettersVisitor extends Object with RecursiveAstVisitor<Object> {
|
||||
bindMappings[stringLiteralToString(entry.key)] =
|
||||
stringLiteralToString(entry.value);
|
||||
} else {
|
||||
logger.error('`bind` currently only supports string literals '
|
||||
logger.error('`properties` currently only supports string literals '
|
||||
'(${entry})');
|
||||
}
|
||||
});
|
||||
@ -25,12 +25,12 @@ class ExtractSettersVisitor extends Object with RecursiveAstVisitor<Object> {
|
||||
|
||||
@override
|
||||
Object visitNamedExpression(NamedExpression node) {
|
||||
if ('${node.name.label}' == 'bind') {
|
||||
if ('${node.name.label}' == 'properties') {
|
||||
// TODO(kegluneq): Remove this restriction.
|
||||
if (node.expression is MapLiteral) {
|
||||
_extractFromMapLiteral(node.expression);
|
||||
} else {
|
||||
logger.error('`bind` currently only supports map literals');
|
||||
logger.error('`properties` currently only supports map literals');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -200,6 +200,6 @@ class _Tester {
|
||||
return metaName == 'Component' ||
|
||||
metaName == 'Decorator' ||
|
||||
metaName == 'Injectable' ||
|
||||
metaName == 'Template';
|
||||
metaName == 'View';
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import 'rewriter.dart';
|
||||
/// reflector.
|
||||
///
|
||||
/// This will also create .ng_deps.dart files for classes annotated
|
||||
/// with @Component, @Template, @Decorator, etc.
|
||||
/// with @Component, @View, @Decorator, etc.
|
||||
///
|
||||
/// This transformer is the first phase in a two-phase transform. It should
|
||||
/// be followed by [DirectiveLinker].
|
||||
|
@ -17,12 +17,12 @@ class Context {
|
||||
final Map<LibraryElement, String> _libraryPrefixes = {};
|
||||
|
||||
/// Whether to generate constructor stubs for classes annotated
|
||||
/// with [Component], [Decorator], [Template], and [Inject] (and subtypes).
|
||||
/// with [Component], [Decorator], [View], and [Inject] (and subtypes).
|
||||
bool generateCtorStubs = true;
|
||||
|
||||
/// Whether to generate setter stubs for classes annotated with
|
||||
/// [Directive] subtypes. These setters depend on the value passed to the
|
||||
/// annotation's `bind` value.
|
||||
/// annotation's `properties` value.
|
||||
bool generateSetterStubs = true;
|
||||
|
||||
DirectiveRegistry _directiveRegistry;
|
||||
@ -499,7 +499,7 @@ class _BindTransformVisitor extends Object
|
||||
if (entry.key is SimpleStringLiteral) {
|
||||
_visitNode(entry.key);
|
||||
} else {
|
||||
logger.error('`bind` currently only supports string literals');
|
||||
logger.error('`properties` currently only supports string literals');
|
||||
}
|
||||
});
|
||||
return null;
|
||||
|
@ -57,7 +57,7 @@ class Angular2Types {
|
||||
static final _applicationLibAssetId =
|
||||
new AssetId('angular2', 'lib/src/core/application.dart');
|
||||
static final _templateLibAssetId =
|
||||
new AssetId('angular2', 'lib/src/core/annotations/template.dart');
|
||||
new AssetId('angular2', 'lib/src/core/annotations/view.dart');
|
||||
static final _reflectionCapabilitiesLibAssetId = new AssetId(
|
||||
'angular2', 'lib/src/reflection/reflection_capabilities.dart');
|
||||
|
||||
@ -85,7 +85,7 @@ class Angular2Types {
|
||||
|
||||
LibraryElement get templateLib => _resolver.getLibrary(_templateLibAssetId);
|
||||
|
||||
ClassElement get templateAnnotation => _getTypeSafe(templateLib, 'Template');
|
||||
ClassElement get templateAnnotation => _getTypeSafe(templateLib, 'View');
|
||||
|
||||
LibraryElement get reflectionCapabilitiesLib =>
|
||||
_resolver.getLibrary(_reflectionCapabilitiesLibAssetId);
|
||||
|
@ -22,7 +22,7 @@ import 'package:code_transformers/assets.dart';
|
||||
import 'recording_reflection_capabilities.dart';
|
||||
|
||||
/// Reads the `.ng_deps.dart` file represented by `entryPoint` and parses any
|
||||
/// Angular 2 `Template` annotations it declares to generate `getter`s,
|
||||
/// Angular 2 `View` annotations it declares to generate `getter`s,
|
||||
/// `setter`s, and `method`s that would otherwise be reflectively accessed.
|
||||
///
|
||||
/// This method assumes a [DomAdapter] has been registered.
|
||||
@ -80,7 +80,7 @@ Iterable<String> _generateMethods(String typeName, List<String> methodNames) {
|
||||
''');
|
||||
}
|
||||
|
||||
/// Extracts `inline` and `url` values from `Template` annotations, reads
|
||||
/// Extracts `template` and `url` values from `View` annotations, reads
|
||||
/// template code if necessary, and determines what values will be
|
||||
/// reflectively accessed from that template.
|
||||
class _TemplateExtractor {
|
||||
@ -131,7 +131,7 @@ class _TemplateExtractor {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
// TODO(kegluneq): Rewrite these to `inline` where possible.
|
||||
// TODO(kegluneq): Rewrite these to `template` where possible.
|
||||
// See [https://github.com/angular/angular/issues/1035].
|
||||
Future<String> _readUrlTemplate(String url) async {
|
||||
var assetId = uriToAssetId(_entryPoint, url, logger, null);
|
||||
@ -165,7 +165,7 @@ class _TemplateExtractVisitor extends Object with RecursiveAstVisitor<Object> {
|
||||
return null;
|
||||
}
|
||||
var keyString = '${node.name.label}';
|
||||
if (keyString == 'inline' || keyString == 'url') {
|
||||
if (keyString == 'template' || keyString == 'templateUrl') {
|
||||
if (node.expression is! SimpleStringLiteral) {
|
||||
logger.error(
|
||||
'Angular 2 currently only supports string literals in directives.'
|
||||
@ -173,7 +173,7 @@ class _TemplateExtractVisitor extends Object with RecursiveAstVisitor<Object> {
|
||||
return null;
|
||||
}
|
||||
var valueString = stringLiteralToString(node.expression);
|
||||
if (keyString == 'url') {
|
||||
if (keyString == 'templateUrl') {
|
||||
urlValues.add(valueString);
|
||||
} else {
|
||||
inlineValues.add(valueString);
|
||||
|
Reference in New Issue
Block a user