Skip to content

Commit e7a312e

Browse files
committed
1 parent bb98990 commit e7a312e

File tree

3 files changed

+38
-25
lines changed

3 files changed

+38
-25
lines changed

lib/tools/template_cache_generator.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ class TemplateCollectingVisitor {
119119
this.sourceCrawler);
120120

121121
call(CompilationUnitElement cue, String srcPath) {
122+
processDeclarations(cue, srcPath);
123+
124+
cue.enclosingElement.parts.forEach((CompilationUnitElement part) {
125+
processDeclarations(part, srcPath);
126+
});
127+
}
128+
129+
void processDeclarations(CompilationUnitElement cue, String srcPath) {
122130
CompilationUnit cu = sourceCrawler.context
123131
.resolveCompilationUnit(cue.source, cue.library);
124132
cu.declarations.forEach((CompilationUnitMember declaration) {
@@ -166,8 +174,7 @@ class TemplateCollectingVisitor {
166174
});
167175
}
168176

169-
bool extractNgTemplateCache(
170-
Annotation ann, List<String> cacheUris) {
177+
bool extractNgTemplateCache(Annotation ann, List<String> cacheUris) {
171178
bool cache = true;
172179
ann.arguments.arguments.forEach((Expression arg) {
173180
if (arg is NamedExpression) {

test/io/test_files/templates/main.dart

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,7 @@ library test_files.main;
33
import 'package:angular/core/module.dart';
44
import 'package:angular/tools/template_cache_annotation.dart';
55

6-
@NgComponent(
7-
selector: 'my-component',
8-
templateUrl: '/test/io/test_files/templates/main.html')
9-
@NgTemplateCache()
10-
class MyComponent
11-
{
12-
}
6+
part 'partial.dart';
137

14-
@NgComponent(
15-
selector: 'my-component2',
16-
templateUrl: '/test/io/test_files/templates/dont.html')
17-
@NgTemplateCache(cache: false)
18-
class MyComponent2
19-
{
20-
}
21-
22-
23-
@NgComponent(
24-
selector: 'my-component3',
25-
templateUrl: '/test/io/test_files/templates/dont.html')
26-
@NgTemplateCache(cache: true)
27-
class MyComponent3
28-
{
29-
}
8+
class MainClass {
9+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
part of 'main.dart';
2+
3+
@NgComponent(
4+
selector: 'my-component',
5+
templateUrl: '/test/io/test_files/templates/main.html')
6+
@NgTemplateCache()
7+
class MyComponent
8+
{
9+
}
10+
11+
@NgComponent(
12+
selector: 'my-component2',
13+
templateUrl: '/test/io/test_files/templates/dont.html')
14+
@NgTemplateCache(cache: false)
15+
class MyComponent2
16+
{
17+
}
18+
19+
20+
@NgComponent(
21+
selector: 'my-component3',
22+
templateUrl: '/test/io/test_files/templates/dont.html')
23+
@NgTemplateCache(cache: true)
24+
class MyComponent3
25+
{
26+
}

0 commit comments

Comments
 (0)