Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions benchmark/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ packages:
analyzer:
description: analyzer
source: hosted
version: "0.13.6"
version: "0.15.7"
angular:
description:
path: ".."
Expand All @@ -30,23 +30,25 @@ packages:
code_transformers:
description: code_transformers
source: hosted
version: "0.1.3"
version: "0.1.4+2"
collection:
description: collection
source: hosted
version: "0.9.2"
di:
description: di
source: hosted
version: "1.0.0"
description:
path: "../../di.dart"
relative: true
source: path
version: "2.0.0-alpha.9"
html5lib:
description: html5lib
source: hosted
version: "0.10.0"
intl:
description: intl
source: hosted
version: "0.9.9"
version: "0.9.10"
logging:
description: logging
source: hosted
Expand Down
1 change: 1 addition & 0 deletions benchmark/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ transformers:
- $dart2js:
minify: false
checked: false
commandLineOptions: [--dump-info]
2 changes: 1 addition & 1 deletion benchmark/watch_group_perf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:benchmark_harness/benchmark_harness.dart';

@MirrorsUsed(
targets: const [
'angular.perf.watch_group'
'angular.benchmarks.watch_group'
],
override: '*'
)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/web/tree.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ main() {
..bind(NgFreeTree)
..bind(NgFreeTreeScoped)
..bind(NgFreeTreeClass)
..bind(ScopeDigestTTL, toFactory: (_) => new ScopeDigestTTL.value(15))
..bind(ScopeDigestTTL, toFactory: () => new ScopeDigestTTL.value(15))
..bind(CompilerConfig, toValue: new CompilerConfig.withOptions(elementProbeEnabled: false));

var injector = applicationFactory().addModule(module).run();
Expand Down
14 changes: 9 additions & 5 deletions bin/parser_generator_for_spec.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import 'dart:io' as io;

import 'package:di/di.dart';
import 'package:di/dynamic_injector.dart';
import 'package:angular/cache/module.dart';
import 'package:angular/core/parser/lexer.dart';
import 'package:angular/core/parser/parser.dart';
import 'package:angular/tools/parser_getter_setter/generator.dart';

main(arguments) {
Module module = new Module()..bind(Parser, toFactory: (i) => i.get(DynamicParser));
module.bind(ParserBackend, toFactory: (i) => i.get(DartGetterSetterGen));
Injector injector = new DynamicInjector(modules: [module],
allowImplicitInjection: true);
Module module = new Module()
..bind(Lexer)
..bind(ParserGetterSetter)
..bind(Parser, toImplementation: DynamicParser)
..install(new CacheModule());
module.bind(ParserBackend, toImplementation: DartGetterSetterGen);
Injector injector = new ModuleInjector([module]);

// List generated using:
// node node_modules/karma/bin/karma run | grep -Eo ":XNAY:.*:XNAY:" | sed -e 's/:XNAY://g' | sed -e "s/^/'/" | sed -e "s/$/',/" | sort | uniq > missing_expressions
Expand Down
15 changes: 9 additions & 6 deletions lib/application.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import 'package:angular/routing/module.dart';
import 'package:angular/introspection_js.dart';

import 'package:angular/core_dom/static_keys.dart';
import 'package:angular/core_dom/directive_injector.dart';

/**
* This is the top level module which describes all Angular components,
Expand All @@ -96,6 +97,7 @@ import 'package:angular/core_dom/static_keys.dart';
*/
class AngularModule extends Module {
AngularModule() {
DirectiveInjector.initUID();
install(new CacheModule());
install(new CoreModule());
install(new CoreDomModule());
Expand All @@ -105,7 +107,6 @@ class AngularModule extends Module {
install(new PerfModule());
install(new RoutingModule());

bind(MetadataExtractor);
bind(Expando, toValue: elementExpando);
}
}
Expand Down Expand Up @@ -152,7 +153,7 @@ abstract class Application {
modules.add(ngModule);
ngModule..bind(VmTurnZone, toValue: zone)
..bind(Application, toValue: this)
..bind(dom.Node, toFactory: (i) => i.getByKey(new Key(Application)).element);
..bind(dom.Node, toFactory: (Application app) => app.element, inject: [Application]);
}

/**
Expand All @@ -175,9 +176,11 @@ abstract class Application {
injector.getByKey(JS_CACHE_REGISTER_KEY);
initializeDateFormatting(null, null).then((_) {
try {
var compiler = injector.getByKey(COMPILER_KEY);
var viewFactory = compiler(rootElements, injector.getByKey(DIRECTIVE_MAP_KEY));
viewFactory(injector, rootElements);
Compiler compiler = injector.getByKey(COMPILER_KEY);
DirectiveMap directiveMap = injector.getByKey(DIRECTIVE_MAP_KEY);
RootScope rootScope = injector.getByKey(ROOT_SCOPE_KEY);
ViewFactory viewFactory = compiler(rootElements, directiveMap);
viewFactory(rootScope, injector.get(DirectiveInjector), rootElements);
} catch (e, s) {
exceptionHandler(e, s);
}
Expand All @@ -190,5 +193,5 @@ abstract class Application {
* Creates an injector function that can be used for retrieving services as well as for
* dependency injection.
*/
Injector createInjector();
Injector createInjector() => new ModuleInjector(modules);
}
3 changes: 0 additions & 3 deletions lib/application_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
library angular.app.factory;

import 'package:di/dynamic_injector.dart';
import 'package:angular/angular.dart';
import 'package:angular/core/registry.dart';
import 'package:angular/core/parser/parser.dart' show ClosureMap;
Expand Down Expand Up @@ -64,8 +63,6 @@ class _DynamicApplication extends Application {
..bind(FieldGetterFactory, toImplementation: DynamicFieldGetterFactory)
..bind(ClosureMap, toImplementation: DynamicClosureMap);
}

Injector createInjector() => new DynamicInjector(modules: modules);
}

/**
Expand Down
26 changes: 9 additions & 17 deletions lib/application_factory_static.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
*/
library angular.app.factory.static;

import 'package:di/static_injector.dart';
import 'package:di/di.dart' show TypeFactory, Injector;
import 'package:angular/application.dart';
import 'package:angular/core/registry.dart';
import 'package:angular/core/parser/parser.dart';
Expand All @@ -46,9 +44,7 @@ export 'package:angular/change_detection/change_detection.dart' show
FieldSetter;

class _StaticApplication extends Application {
final Map<Type, TypeFactory> typeFactories;

_StaticApplication(Map<Type, TypeFactory> this.typeFactories,
_StaticApplication(
Map<Type, Object> metadata,
Map<String, FieldGetter> fieldGetters,
Map<String, FieldSetter> fieldSetters,
Expand All @@ -58,9 +54,6 @@ class _StaticApplication extends Application {
..bind(FieldGetterFactory, toValue: new StaticFieldGetterFactory(fieldGetters))
..bind(ClosureMap, toValue: new StaticClosureMap(fieldGetters, fieldSetters, symbols));
}

Injector createInjector() =>
new StaticInjector(modules: modules, typeFactories: typeFactories);
}

/**
Expand All @@ -81,20 +74,19 @@ class _StaticApplication extends Application {
* becomes:
*
* main() {
* staticApplication(generated_static_injector.factories,
* generated_static_metadata.typeAnnotations,
* generated_static_expressions.getters,
* generated_static_expressions.setters,
* generated_static_expressions.symbols)
* .addModule(new Module()..bind(HelloWorldController))
* .run();
* staticApplication(
* generated_static_metadata.typeAnnotations,
* generated_static_expressions.getters,
* generated_static_expressions.setters,
* generated_static_expressions.symbols)
* .addModule(new Module()..bind(HelloWorldController))
* .run();
*
*/
Application staticApplicationFactory(
Map<Type, TypeFactory> typeFactories,
Map<Type, Object> metadata,
Map<String, FieldGetter> fieldGetters,
Map<String, FieldSetter> fieldSetters,
Map<String, Symbol> symbols) {
return new _StaticApplication(typeFactories, metadata, fieldGetters, fieldSetters, symbols);
return new _StaticApplication(metadata, fieldGetters, fieldSetters, symbols);
}
3 changes: 3 additions & 0 deletions lib/cache/module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ class CacheModule extends Module {
CacheModule() {
bind(CacheRegister);
}
CacheModule.withReflector(reflector): super.withReflector(reflector) {
bind(CacheRegister);
}
}
1 change: 1 addition & 0 deletions lib/change_detection/ast_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ library angular.change_detection.ast_parser;

import 'dart:collection';

import 'package:di/di.dart' show Injectable;
import 'package:angular/core/parser/syntax.dart' as syntax;
import 'package:angular/core/parser/parser.dart';
import 'package:angular/core/formatter.dart';
Expand Down
11 changes: 9 additions & 2 deletions lib/change_detection/watch_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -672,10 +672,11 @@ abstract class _ArgHandler extends _Handler {
}

class _PositionalArgHandler extends _ArgHandler {
static final List<String> _ARGS = new List.generate(20, (index) => 'arg[$index]');
final int index;
_PositionalArgHandler(WatchGroup watchGrp, _EvalWatchRecord record, int index)
: this.index = index,
super(watchGrp, 'arg[$index]', record);
super(watchGrp, _ARGS[index], record);

void acceptValue(object) {
watchRecord.dirtyArgs = true;
Expand All @@ -684,11 +685,17 @@ class _PositionalArgHandler extends _ArgHandler {
}

class _NamedArgHandler extends _ArgHandler {
static final Map<Symbol, String> _NAMED_ARG = new HashMap<Symbol, String>();
static String _GET_NAMED_ARG(Symbol symbol) {
String name = _NAMED_ARG[symbol];
if (name == null) name = _NAMED_ARG[symbol] = 'namedArg[$name]';
return name;
}
final Symbol name;

_NamedArgHandler(WatchGroup watchGrp, _EvalWatchRecord record, Symbol name)
: this.name = name,
super(watchGrp, 'namedArg[$name]', record);
super(watchGrp, _GET_NAMED_ARG(name), record);

void acceptValue(object) {
if (watchRecord.namedArgs == null) {
Expand Down
4 changes: 3 additions & 1 deletion lib/core/annotation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ export "package:angular/core/annotation_src.dart" show
ShadowRootAware,

Formatter,
Injectable,
DirectiveBinder,
DirectiveBinderFn,

Directive,
Component,
Controller,
Decorator,
Visibility,

DirectiveAnnotation,
NgAttr,
Expand Down
Loading