feat(transformers): updated transformers
This commit is contained in:
parent
69b75b7fd8
commit
e5419febe4
|
@ -61,6 +61,7 @@ class _DirectiveMetadataVisitor extends Object
|
|||
hostProperties: {},
|
||||
hostAttributes: {},
|
||||
readAttributes: [],
|
||||
exportAs: null,
|
||||
callOnDestroy: false,
|
||||
callOnChange: false,
|
||||
callOnCheck: false,
|
||||
|
@ -136,6 +137,9 @@ class _DirectiveMetadataVisitor extends Object
|
|||
case 'lifecycle':
|
||||
_populateLifecycle(node.expression);
|
||||
break;
|
||||
case 'exportAs':
|
||||
_populateExportAs(node.expression);
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -225,6 +229,11 @@ class _DirectiveMetadataVisitor extends Object
|
|||
hostAttributeValue, meta.hostAttributes, 'Directive#hostAttributes');
|
||||
}
|
||||
|
||||
void _populateExportAs(Expression exportAsValue) {
|
||||
_checkMeta();
|
||||
meta.exportAs = _expressionToString(exportAsValue, 'Directive#exportAs');
|
||||
}
|
||||
|
||||
void _populateLifecycle(Expression lifecycleValue) {
|
||||
_checkMeta();
|
||||
if (lifecycleValue is! ListLiteral) {
|
||||
|
|
|
@ -67,6 +67,12 @@ void allTests() {
|
|||
expect(metadata.properties).toContain('key2: val2');
|
||||
});
|
||||
|
||||
it('should parse exportAs.', () async {
|
||||
var metadata = await readMetadata('directive_metadata_extractor/'
|
||||
'directive_metadata_files/directive_export_as.ng_deps.dart');
|
||||
expect(metadata.exportAs).toEqual('exportAsName');
|
||||
});
|
||||
|
||||
it('should parse host listeners.', () async {
|
||||
var metadata = await readMetadata('directive_metadata_extractor/'
|
||||
'directive_metadata_files/host_listeners.ng_deps.dart');
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
library examples.hello_world.index_common_dart.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Directive, View, NgElement, onChange, onDestroy, onInit, onCheck, onAllChangesDone;
|
||||
|
||||
var _visited = false;
|
||||
void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, {
|
||||
'factory': () => new HelloCmp(),
|
||||
'parameters': const [const []],
|
||||
'annotations': const [
|
||||
const Directive(exportAs: 'exportAsName')
|
||||
]
|
||||
});
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
"properties": [],
|
||||
"readAttributes": [],
|
||||
"type": 1,
|
||||
"exportAs": null,
|
||||
"callOnDestroy": false,
|
||||
"callOnCheck": false,
|
||||
"callOnInit": false,
|
||||
|
|
Loading…
Reference in New Issue