Skip to content

Commit

Permalink
feat(cache): Add existing caches to CacheRegister
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdeboer authored and Diana Salsbury committed Jul 16, 2014
1 parent ebdb282 commit 90b90e2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/core/interpolate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ part of angular.core_internal;
@Injectable()
class Interpolate implements Function {
var _cache = new HashMap();

Interpolate(CacheRegister cacheRegister) {
cacheRegister.registerCache("Interpolate", _cache);
}
/**
* Compiles markup text into expression.
*
Expand Down
1 change: 1 addition & 0 deletions lib/core/module_internal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:angular/utils.dart';

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

import 'package:angular/cache/module.dart';
import 'package:angular/change_detection/watch_group.dart';
export 'package:angular/change_detection/watch_group.dart';
import 'package:angular/change_detection/ast_parser.dart';
Expand Down
5 changes: 4 additions & 1 deletion lib/core/parser/dynamic_parser.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
library angular.core.parser.dynamic_parser;

import 'package:angular/cache/module.dart';
import 'package:angular/core/annotation_src.dart' hide Formatter;
import 'package:angular/core/module_internal.dart' show FormatterMap;

Expand All @@ -24,7 +25,9 @@ class DynamicParser implements Parser<Expression> {
final Lexer _lexer;
final ParserBackend _backend;
final Map<String, Expression> _cache = {};
DynamicParser(this._lexer, this._backend);
DynamicParser(this._lexer, this._backend, CacheRegister cacheRegister) {
cacheRegister.registerCache("DynamicParser", _cache);
}

Expression call(String input) {
if (input == null) input = '';
Expand Down
5 changes: 4 additions & 1 deletion lib/core/parser/static_parser.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
library angular.core.parser.static_parser;

import 'package:angular/cache/module.dart' show CacheRegister;
import 'package:angular/core/annotation_src.dart' show Injectable;
import 'package:angular/core/module_internal.dart' show FormatterMap;
import 'package:angular/core/parser/parser.dart';
Expand All @@ -17,7 +18,9 @@ class StaticParser implements Parser<Expression> {
final StaticParserFunctions _functions;
final DynamicParser _fallbackParser;
final _cache = new HashMap<String, Expression>();
StaticParser(this._functions, this._fallbackParser);
StaticParser(this._functions, this._fallbackParser, CacheRegister cacheRegister) {
cacheRegister.registerCache("StaticParser", _cache);
}

Expression call(String input) {
if (input == null) input = '';
Expand Down
2 changes: 2 additions & 0 deletions lib/core_dom/static_keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ library angular.core_dom.static_keys;

import 'dart:html' as dom;
import 'package:di/di.dart';
import 'package:angular/cache/module.dart';
import 'package:angular/core/static_keys.dart';
import 'package:angular/core_dom/module_internal.dart';

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

Key ANIMATE_KEY = new Key(Animate);
Key BOUND_VIEW_FACTORY_KEY = new Key(BoundViewFactory);
Key CACHE_REGISTER_KEY = new Key(CacheRegister);
Key COMPILER_KEY = new Key(Compiler);
Key COMPONENT_CSS_REWRITER_KEY = new Key(ComponentCssRewriter);
Key DIRECTIVE_MAP_KEY = new Key(DirectiveMap);
Expand Down

0 comments on commit 90b90e2

Please sign in to comment.