Skip to content

Commit 90b90e2

Browse files
jbdeboerDiana Salsbury
authored and
Diana Salsbury
committed
feat(cache): Add existing caches to CacheRegister
Closes dart-archive#1165
1 parent ebdb282 commit 90b90e2

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

lib/core/interpolate.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ part of angular.core_internal;
1111
@Injectable()
1212
class Interpolate implements Function {
1313
var _cache = new HashMap();
14+
15+
Interpolate(CacheRegister cacheRegister) {
16+
cacheRegister.registerCache("Interpolate", _cache);
17+
}
1418
/**
1519
* Compiles markup text into expression.
1620
*

lib/core/module_internal.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import 'package:angular/utils.dart';
1414

1515
import 'package:angular/core/annotation_src.dart';
1616

17+
import 'package:angular/cache/module.dart';
1718
import 'package:angular/change_detection/watch_group.dart';
1819
export 'package:angular/change_detection/watch_group.dart';
1920
import 'package:angular/change_detection/ast_parser.dart';

lib/core/parser/dynamic_parser.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
library angular.core.parser.dynamic_parser;
22

3+
import 'package:angular/cache/module.dart';
34
import 'package:angular/core/annotation_src.dart' hide Formatter;
45
import 'package:angular/core/module_internal.dart' show FormatterMap;
56

@@ -24,7 +25,9 @@ class DynamicParser implements Parser<Expression> {
2425
final Lexer _lexer;
2526
final ParserBackend _backend;
2627
final Map<String, Expression> _cache = {};
27-
DynamicParser(this._lexer, this._backend);
28+
DynamicParser(this._lexer, this._backend, CacheRegister cacheRegister) {
29+
cacheRegister.registerCache("DynamicParser", _cache);
30+
}
2831

2932
Expression call(String input) {
3033
if (input == null) input = '';

lib/core/parser/static_parser.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
library angular.core.parser.static_parser;
22

3+
import 'package:angular/cache/module.dart' show CacheRegister;
34
import 'package:angular/core/annotation_src.dart' show Injectable;
45
import 'package:angular/core/module_internal.dart' show FormatterMap;
56
import 'package:angular/core/parser/parser.dart';
@@ -17,7 +18,9 @@ class StaticParser implements Parser<Expression> {
1718
final StaticParserFunctions _functions;
1819
final DynamicParser _fallbackParser;
1920
final _cache = new HashMap<String, Expression>();
20-
StaticParser(this._functions, this._fallbackParser);
21+
StaticParser(this._functions, this._fallbackParser, CacheRegister cacheRegister) {
22+
cacheRegister.registerCache("StaticParser", _cache);
23+
}
2124

2225
Expression call(String input) {
2326
if (input == null) input = '';

lib/core_dom/static_keys.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ library angular.core_dom.static_keys;
22

33
import 'dart:html' as dom;
44
import 'package:di/di.dart';
5+
import 'package:angular/cache/module.dart';
56
import 'package:angular/core/static_keys.dart';
67
import 'package:angular/core_dom/module_internal.dart';
78

@@ -12,6 +13,7 @@ export 'package:angular/core/static_keys.dart';
1213

1314
Key ANIMATE_KEY = new Key(Animate);
1415
Key BOUND_VIEW_FACTORY_KEY = new Key(BoundViewFactory);
16+
Key CACHE_REGISTER_KEY = new Key(CacheRegister);
1517
Key COMPILER_KEY = new Key(Compiler);
1618
Key COMPONENT_CSS_REWRITER_KEY = new Key(ComponentCssRewriter);
1719
Key DIRECTIVE_MAP_KEY = new Key(DirectiveMap);

0 commit comments

Comments
 (0)