feat: remove MapWrapper.create()/get()/set().
Better dart2js code, better Angular code.
This commit is contained in:
@ -471,7 +471,7 @@ function createDirectiveBinding(directiveResolver, type) {
|
||||
}
|
||||
|
||||
function createProtoView(elementBinders = null) {
|
||||
var pv = new AppProtoView(null, null, MapWrapper.create(), null);
|
||||
var pv = new AppProtoView(null, null, new Map(), null);
|
||||
if (isBlank(elementBinders)) {
|
||||
elementBinders = [];
|
||||
}
|
||||
@ -581,11 +581,11 @@ class FakeTemplateResolver extends TemplateResolver {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this._cmpTemplates = MapWrapper.create();
|
||||
this._cmpTemplates = new Map();
|
||||
}
|
||||
|
||||
resolve(component: Type): viewAnn.View {
|
||||
var template = MapWrapper.get(this._cmpTemplates, component);
|
||||
var template = this._cmpTemplates.get(component);
|
||||
if (isBlank(template)) {
|
||||
// dynamic component
|
||||
return null;
|
||||
@ -593,9 +593,7 @@ class FakeTemplateResolver extends TemplateResolver {
|
||||
return template;
|
||||
}
|
||||
|
||||
setView(component: Type, template: viewAnn.View) {
|
||||
MapWrapper.set(this._cmpTemplates, component, template);
|
||||
}
|
||||
setView(component: Type, template: viewAnn.View) { this._cmpTemplates.set(component, template); }
|
||||
}
|
||||
|
||||
class FakeProtoViewFactory extends ProtoViewFactory {
|
||||
|
@ -879,9 +879,9 @@ export function main() {
|
||||
|
||||
describe('static attributes', () => {
|
||||
it('should be injectable', () => {
|
||||
var attributes = MapWrapper.create();
|
||||
MapWrapper.set(attributes, 'type', 'text');
|
||||
MapWrapper.set(attributes, 'title', '');
|
||||
var attributes = new Map();
|
||||
attributes.set( 'type', 'text');
|
||||
attributes.set( 'title', '');
|
||||
|
||||
var inj = injector(ListWrapper.concat([NeedsAttribute], extraBindings), null, false, null,
|
||||
attributes);
|
||||
@ -893,8 +893,8 @@ export function main() {
|
||||
});
|
||||
|
||||
it('should be injectable without type annotation', () => {
|
||||
var attributes = MapWrapper.create();
|
||||
MapWrapper.set(attributes, 'foo', 'bar');
|
||||
var attributes = new Map();
|
||||
attributes.set( 'foo', 'bar');
|
||||
|
||||
var inj = injector(ListWrapper.concat([NeedsAttributeNoType], extraBindings), null, false,
|
||||
null, attributes);
|
||||
|
@ -131,7 +131,7 @@ export function main() {
|
||||
it("should not throw when not binding to a name exported by two directives", () => {
|
||||
expect(() => {
|
||||
createDirectiveVariableBindings(
|
||||
new renderApi.ElementBinder({variableBindings: MapWrapper.create()}), [
|
||||
new renderApi.ElementBinder({variableBindings: new Map()}), [
|
||||
directiveBinding(
|
||||
{metadata: renderApi.DirectiveMetadata.create({exportAs: 'exportName'})}),
|
||||
directiveBinding(
|
||||
@ -167,7 +167,7 @@ function createRenderProtoView(elementBinders = null, type: renderApi.ViewType =
|
||||
elementBinders = [];
|
||||
}
|
||||
return new renderApi.ProtoViewDto(
|
||||
{elementBinders: elementBinders, type: type, variableBindings: MapWrapper.create()});
|
||||
{elementBinders: elementBinders, type: type, variableBindings: new Map()});
|
||||
}
|
||||
|
||||
function createRenderComponentElementBinder(directiveIndex) {
|
||||
|
@ -37,7 +37,7 @@ export function main() {
|
||||
|
||||
function createProtoView() { return new AppProtoView(null, null, null, null); }
|
||||
|
||||
function createView() { return new AppView(null, createProtoView(), MapWrapper.create()); }
|
||||
function createView() { return new AppView(null, createProtoView(), new Map()); }
|
||||
|
||||
function createViewContainer() { return new ViewContainerRef(viewManager, location); }
|
||||
|
||||
|
@ -100,7 +100,7 @@ export function main() {
|
||||
if (isBlank(renderViewRef)) {
|
||||
renderViewRef = new RenderViewRef();
|
||||
}
|
||||
var view = new AppView(renderer, pv, MapWrapper.create());
|
||||
var view = new AppView(renderer, pv, new Map());
|
||||
view.render = renderViewRef;
|
||||
var elementInjectors = ListWrapper.createFixedSize(pv.elementBinders.length);
|
||||
for (var i = 0; i < pv.elementBinders.length; i++) {
|
||||
|
@ -86,7 +86,7 @@ export function main() {
|
||||
if (isBlank(pv)) {
|
||||
pv = createProtoView();
|
||||
}
|
||||
var view = new AppView(null, pv, MapWrapper.create());
|
||||
var view = new AppView(null, pv, new Map());
|
||||
var elementInjectors = ListWrapper.createFixedSize(pv.elementBinders.length);
|
||||
var preBuiltObjects = ListWrapper.createFixedSize(pv.elementBinders.length);
|
||||
for (var i = 0; i < pv.elementBinders.length; i++) {
|
||||
|
@ -26,7 +26,7 @@ export function main() {
|
||||
|
||||
function createProtoView() { return new AppProtoView(null, null, null, null); }
|
||||
|
||||
function createView(pv) { return new AppView(null, pv, MapWrapper.create()); }
|
||||
function createView(pv) { return new AppView(null, pv, new Map()); }
|
||||
|
||||
it('should support multiple AppProtoViews', () => {
|
||||
var vf = createViewPool({capacity: 2});
|
||||
|
Reference in New Issue
Block a user