refactor: misc cleanup (#10046)
This commit is contained in:
parent
4a965052f9
commit
42b0c1d8a2
|
@ -205,7 +205,7 @@ class TemplatePreparseVisitor implements HtmlAstVisitor {
|
|||
var textContent = '';
|
||||
ast.children.forEach(child => {
|
||||
if (child instanceof HtmlTextAst) {
|
||||
textContent += (<HtmlTextAst>child).value;
|
||||
textContent += child.value;
|
||||
}
|
||||
});
|
||||
this.styles.push(textContent);
|
||||
|
|
|
@ -62,30 +62,22 @@ export class DirectiveResolver {
|
|||
} else {
|
||||
inputs.push(propName);
|
||||
}
|
||||
}
|
||||
|
||||
if (a instanceof OutputMetadata) {
|
||||
} else if (a instanceof OutputMetadata) {
|
||||
if (isPresent(a.bindingPropertyName)) {
|
||||
outputs.push(`${propName}: ${a.bindingPropertyName}`);
|
||||
} else {
|
||||
outputs.push(propName);
|
||||
}
|
||||
}
|
||||
|
||||
if (a instanceof HostBindingMetadata) {
|
||||
} else if (a instanceof HostBindingMetadata) {
|
||||
if (isPresent(a.hostPropertyName)) {
|
||||
host[`[${a.hostPropertyName}]`] = propName;
|
||||
} else {
|
||||
host[`[${propName}]`] = propName;
|
||||
}
|
||||
}
|
||||
|
||||
if (a instanceof HostListenerMetadata) {
|
||||
} else if (a instanceof HostListenerMetadata) {
|
||||
var args = isPresent(a.args) ? (<any[]>a.args).join(', ') : '';
|
||||
host[`(${a.eventName})`] = `${propName}(${args})`;
|
||||
}
|
||||
|
||||
if (a instanceof QueryMetadata) {
|
||||
} else if (a instanceof QueryMetadata) {
|
||||
queries[propName] = a;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -63,7 +63,7 @@ function createDynamicClass(
|
|||
};
|
||||
});
|
||||
_classStmt.methods.forEach(function(method: o.ClassMethod) {
|
||||
var paramNames = method.params.map(param => param.name);
|
||||
const paramNames = method.params.map(param => param.name);
|
||||
// Note: use `function` instead of arrow function to capture `this`
|
||||
propertyDescriptors[method.name] = {
|
||||
writable: false,
|
||||
|
|
|
@ -72,7 +72,7 @@ export class ProviderElementContext {
|
|||
|
||||
// create the providers that we know are eager first
|
||||
this._allProviders.values().forEach((provider) => {
|
||||
var eager = provider.eager || isPresent(queriedTokens.get(provider.token));
|
||||
const eager = provider.eager || isPresent(queriedTokens.get(provider.token));
|
||||
if (eager) {
|
||||
this._getOrCreateLocalProvider(provider.providerType, provider.token, true);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ export class ProviderElementContext {
|
|||
|
||||
private _addQueryReadsTo(token: CompileTokenMetadata, queryReadTokens: CompileTokenMap<boolean>) {
|
||||
this._getQueriesFor(token).forEach((query) => {
|
||||
var queryReadToken = isPresent(query.read) ? query.read : token;
|
||||
const queryReadToken = isPresent(query.read) ? query.read : token;
|
||||
if (isBlank(queryReadTokens.get(queryReadToken))) {
|
||||
queryReadTokens.add(queryReadToken, true);
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ export class AppModuleProviderParser {
|
|||
constructor(appModule: CompileAppModuleMetadata, sourceSpan: ParseSourceSpan) {
|
||||
this._allProviders = new CompileTokenMap<ProviderAst>();
|
||||
[appModule.type].concat(appModule.modules).forEach((appModuleType: CompileTypeMetadata) => {
|
||||
var appModuleProvider = new CompileProviderMetadata(
|
||||
const appModuleProvider = new CompileProviderMetadata(
|
||||
{token: new CompileTokenMetadata({identifier: appModuleType}), useClass: appModuleType});
|
||||
_resolveProviders(
|
||||
[appModuleProvider], ProviderAstType.PublicService, true, sourceSpan, this._errors,
|
||||
|
@ -297,7 +297,7 @@ export class AppModuleProviderParser {
|
|||
this._allProviders.values().forEach(
|
||||
(provider) => { this._getOrCreateLocalProvider(provider.token, provider.eager); });
|
||||
if (this._errors.length > 0) {
|
||||
var errorString = this._errors.join('\n');
|
||||
const errorString = this._errors.join('\n');
|
||||
throw new BaseException(`Provider parse errors:\n${errorString}`);
|
||||
}
|
||||
return this._transformedProviders.values();
|
||||
|
@ -415,7 +415,7 @@ function _normalizeProviders(
|
|||
if (isArray(provider)) {
|
||||
_normalizeProviders(<any[]>provider, sourceSpan, targetErrors, targetProviders);
|
||||
} else {
|
||||
var normalizeProvider: CompileProviderMetadata;
|
||||
let normalizeProvider: CompileProviderMetadata;
|
||||
if (provider instanceof CompileProviderMetadata) {
|
||||
normalizeProvider = provider;
|
||||
} else if (provider instanceof CompileTypeMetadata) {
|
||||
|
|
|
@ -163,7 +163,8 @@ export class RuntimeCompiler implements ComponentResolver, Compiler {
|
|||
}
|
||||
}
|
||||
});
|
||||
let compile = () => { templates.forEach((template) => { this._compileTemplate(template); }); };
|
||||
const compile =
|
||||
() => { templates.forEach((template) => { this._compileTemplate(template); }); };
|
||||
if (isSync) {
|
||||
compile();
|
||||
}
|
||||
|
@ -212,12 +213,12 @@ export class RuntimeCompiler implements ComponentResolver, Compiler {
|
|||
modulePipes: ConcreteType<any>[]): CompiledTemplate {
|
||||
var compiledTemplate = this._compiledTemplateCache.get(type);
|
||||
if (isBlank(compiledTemplate)) {
|
||||
var compMeta = this._metadataResolver.getDirectiveMetadata(type);
|
||||
const compMeta = this._metadataResolver.getDirectiveMetadata(type);
|
||||
assertComponent(compMeta);
|
||||
var viewDirectives: CompileDirectiveMetadata[] = [];
|
||||
const viewDirectives: CompileDirectiveMetadata[] = [];
|
||||
moduleDirectives.forEach(
|
||||
(type) => viewDirectives.push(this._metadataResolver.getDirectiveMetadata(type)));
|
||||
var viewComponentTypes: Type[] = [];
|
||||
const viewComponentTypes: Type[] = [];
|
||||
this._metadataResolver.getViewDirectivesMetadata(type).forEach(dirOrComp => {
|
||||
if (dirOrComp.isComponent) {
|
||||
viewComponentTypes.push(dirOrComp.type.runtime);
|
||||
|
@ -225,8 +226,8 @@ export class RuntimeCompiler implements ComponentResolver, Compiler {
|
|||
viewDirectives.push(dirOrComp);
|
||||
}
|
||||
});
|
||||
var precompileComponentTypes = compMeta.precompile.map((typeMeta) => typeMeta.runtime);
|
||||
var pipes = [
|
||||
const precompileComponentTypes = compMeta.precompile.map((typeMeta) => typeMeta.runtime);
|
||||
const pipes = [
|
||||
...modulePipes.map((type) => this._metadataResolver.getPipeMetadata(type)),
|
||||
...this._metadataResolver.getViewPipesMetadata(type)
|
||||
];
|
||||
|
@ -242,8 +243,8 @@ export class RuntimeCompiler implements ComponentResolver, Compiler {
|
|||
compType: Type, isHost: boolean, moduleDirectives: ConcreteType<any>[],
|
||||
modulePipes: ConcreteType<any>[],
|
||||
target: Set<CompiledTemplate> = new Set<CompiledTemplate>()): Set<CompiledTemplate> {
|
||||
var template = isHost ? this._createCompiledHostTemplate(compType) :
|
||||
this._createCompiledTemplate(compType, moduleDirectives, modulePipes);
|
||||
const template = isHost ? this._createCompiledHostTemplate(compType) :
|
||||
this._createCompiledTemplate(compType, moduleDirectives, modulePipes);
|
||||
if (!target.has(template)) {
|
||||
target.add(template);
|
||||
template.viewComponentTypes.forEach((compType) => {
|
||||
|
@ -261,22 +262,22 @@ export class RuntimeCompiler implements ComponentResolver, Compiler {
|
|||
if (template.isCompiled) {
|
||||
return;
|
||||
}
|
||||
var compMeta = template.normalizedCompMeta;
|
||||
var externalStylesheetsByModuleUrl = new Map<string, CompiledStylesheet>();
|
||||
var stylesCompileResult = this._styleCompiler.compileComponent(compMeta);
|
||||
const compMeta = template.normalizedCompMeta;
|
||||
const externalStylesheetsByModuleUrl = new Map<string, CompiledStylesheet>();
|
||||
const stylesCompileResult = this._styleCompiler.compileComponent(compMeta);
|
||||
stylesCompileResult.externalStylesheets.forEach(
|
||||
(r) => { externalStylesheetsByModuleUrl.set(r.meta.moduleUrl, r); });
|
||||
this._resolveStylesCompileResult(
|
||||
stylesCompileResult.componentStylesheet, externalStylesheetsByModuleUrl);
|
||||
var viewCompMetas = template.viewComponentTypes.map(
|
||||
const viewCompMetas = template.viewComponentTypes.map(
|
||||
(compType) => this._compiledTemplateCache.get(compType).normalizedCompMeta);
|
||||
var parsedTemplate = this._templateParser.parse(
|
||||
const parsedTemplate = this._templateParser.parse(
|
||||
compMeta, compMeta.template.template, template.viewDirectives.concat(viewCompMetas),
|
||||
template.viewPipes, compMeta.type.name);
|
||||
var compileResult = this._viewCompiler.compileComponent(
|
||||
const compileResult = this._viewCompiler.compileComponent(
|
||||
compMeta, parsedTemplate, ir.variable(stylesCompileResult.componentStylesheet.stylesVar),
|
||||
template.viewPipes);
|
||||
var depTemplates = compileResult.dependencies.map((dep) => {
|
||||
compileResult.dependencies.forEach((dep) => {
|
||||
let depTemplate: CompiledTemplate;
|
||||
if (dep instanceof ViewFactoryDependency) {
|
||||
let vfd = <ViewFactoryDependency>dep;
|
||||
|
@ -289,11 +290,10 @@ export class RuntimeCompiler implements ComponentResolver, Compiler {
|
|||
cfd.placeholder.runtime = depTemplate.proxyComponentFactory;
|
||||
cfd.placeholder.name = `compFactory_${cfd.comp.name}`;
|
||||
}
|
||||
return depTemplate;
|
||||
});
|
||||
var statements =
|
||||
const statements =
|
||||
stylesCompileResult.componentStylesheet.statements.concat(compileResult.statements);
|
||||
var factory: any;
|
||||
let factory: any;
|
||||
if (IS_DART || !this._genConfig.useJit) {
|
||||
factory = interpretStatements(statements, compileResult.viewFactoryVar);
|
||||
} else {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ListWrapper, Map} from '../src/facade/collection';
|
||||
import {ListWrapper} from '../src/facade/collection';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
import {RegExpMatcherWrapper, RegExpWrapper, StringWrapper, isBlank, isPresent} from '../src/facade/lang';
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {ListWrapper} from '../src/facade/collection';
|
||||
import {RegExp, RegExpMatcherWrapper, RegExpWrapper, StringWrapper, isBlank, isPresent} from '../src/facade/lang';
|
||||
import {RegExpMatcherWrapper, RegExpWrapper, StringWrapper, isBlank, isPresent} from '../src/facade/lang';
|
||||
|
||||
/**
|
||||
* This file is a port of shadowCSS from webcomponents.js to TypeScript.
|
||||
|
|
|
@ -13,8 +13,8 @@ import {ShadowCss} from './shadow_css';
|
|||
import {UrlResolver} from './url_resolver';
|
||||
|
||||
const COMPONENT_VARIABLE = '%COMP%';
|
||||
const HOST_ATTR = /*@ts2dart_const*/ `_nghost-${COMPONENT_VARIABLE}`;
|
||||
const CONTENT_ATTR = /*@ts2dart_const*/ `_ngcontent-${COMPONENT_VARIABLE}`;
|
||||
const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
|
||||
const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
|
||||
|
||||
export class StylesCompileDependency {
|
||||
constructor(
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
*/
|
||||
|
||||
import {isPresent} from '../src/facade/lang';
|
||||
|
||||
import {AST} from './expression_parser/ast';
|
||||
|
||||
import {CompileDirectiveMetadata, CompileTokenMetadata, CompileProviderMetadata,} from './compile_metadata';
|
||||
import {ParseSourceSpan} from './parse_util';
|
||||
import {SecurityContext} from '@angular/core';
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
import {Injector, THROW_IF_NOT_FOUND} from '../di/injector';
|
||||
import {unimplemented} from '../facade/exceptions';
|
||||
import {ConcreteType} from '../facade/lang';
|
||||
|
||||
import {ComponentFactory} from './component_factory';
|
||||
import {CodegenComponentFactoryResolver, ComponentFactoryResolver} from './component_factory_resolver';
|
||||
|
||||
|
|
|
@ -9,11 +9,10 @@
|
|||
import {ChangeDetectorRef} from '../change_detection/change_detection';
|
||||
import {Injector} from '../di/injector';
|
||||
import {unimplemented} from '../facade/exceptions';
|
||||
import {Type, isBlank, isPresent} from '../facade/lang';
|
||||
|
||||
import {Type, isBlank} from '../facade/lang';
|
||||
import {AppElement} from './element';
|
||||
import {ElementRef} from './element_ref';
|
||||
import {ViewRef, ViewRef_} from './view_ref';
|
||||
import {ViewRef} from './view_ref';
|
||||
import {ViewUtils} from './view_utils';
|
||||
|
||||
|
||||
|
@ -80,12 +79,11 @@ export class ComponentRef_<C> extends ComponentRef<C> {
|
|||
onDestroy(callback: Function): void { this.hostView.onDestroy(callback); }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
* @ts2dart_const
|
||||
*/
|
||||
const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object();
|
||||
const EMPTY_CONTEXT = new Object();
|
||||
|
||||
/**
|
||||
* @stable
|
||||
|
|
|
@ -6,13 +6,10 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Inject, OpaqueToken, Optional, SkipSelf} from '../di';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {ConcreteType, stringify} from '../facade/lang';
|
||||
|
||||
import {ComponentFactory} from './component_factory';
|
||||
|
||||
|
||||
/**
|
||||
* @stable
|
||||
*/
|
||||
|
|
|
@ -12,10 +12,8 @@ import {PromiseWrapper} from '../facade/async';
|
|||
import {BaseException} from '../facade/exceptions';
|
||||
import {Type, isBlank, isString, stringify} from '../facade/lang';
|
||||
import {reflector} from '../reflection/reflection';
|
||||
|
||||
import {ComponentFactory} from './component_factory';
|
||||
|
||||
|
||||
/**
|
||||
* Low-level service for loading {@link ComponentFactory}s, which
|
||||
* can later be used to create and render a Component instance.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {Injector} from '../di';
|
||||
import {ListWrapper, StringMapWrapper} from '../facade/collection';
|
||||
import {StringMapWrapper} from '../facade/collection';
|
||||
import {isBlank, isPresent} from '../facade/lang';
|
||||
import {RenderDebugInfo} from '../render/api';
|
||||
|
||||
|
@ -51,7 +51,7 @@ export class DebugContext implements RenderDebugInfo {
|
|||
}
|
||||
get injector(): Injector { return this._view.injector(this._nodeIndex); }
|
||||
get renderNode(): any {
|
||||
if (isPresent(this._nodeIndex) && isPresent(this._view.allNodes)) {
|
||||
if (isPresent(this._nodeIndex) && this._view.allNodes) {
|
||||
return this._view.allNodes[this._nodeIndex];
|
||||
} else {
|
||||
return null;
|
||||
|
@ -69,17 +69,15 @@ export class DebugContext implements RenderDebugInfo {
|
|||
var staticNodeInfo = this._staticNodeInfo;
|
||||
if (isPresent(staticNodeInfo)) {
|
||||
var refs = staticNodeInfo.refTokens;
|
||||
StringMapWrapper.forEach(
|
||||
refs, (refToken: any /** TODO #9100 */, refName: any /** TODO #9100 */) => {
|
||||
var varValue: any /** TODO #9100 */;
|
||||
if (isBlank(refToken)) {
|
||||
varValue =
|
||||
isPresent(this._view.allNodes) ? this._view.allNodes[this._nodeIndex] : null;
|
||||
} else {
|
||||
varValue = this._view.injectorGet(refToken, this._nodeIndex, null);
|
||||
}
|
||||
varValues[refName] = varValue;
|
||||
});
|
||||
StringMapWrapper.forEach(refs, (refToken: any, refName: string) => {
|
||||
let varValue: any;
|
||||
if (isBlank(refToken)) {
|
||||
varValue = this._view.allNodes ? this._view.allNodes[this._nodeIndex] : null;
|
||||
} else {
|
||||
varValue = this._view.injectorGet(refToken, this._nodeIndex, null);
|
||||
}
|
||||
varValues[refName] = varValue;
|
||||
});
|
||||
}
|
||||
return varValues;
|
||||
}
|
||||
|
|
|
@ -6,12 +6,8 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Injectable} from '../di/decorators';
|
||||
import {Injector} from '../di/injector';
|
||||
import {ReflectiveInjector} from '../di/reflective_injector';
|
||||
import {ResolvedReflectiveProvider} from '../di/reflective_provider';
|
||||
import {Injectable, Injector, ReflectiveInjector, ResolvedReflectiveProvider} from '../di';
|
||||
import {Type, isPresent} from '../facade/lang';
|
||||
|
||||
import {ComponentRef} from './component_factory';
|
||||
import {ComponentResolver} from './component_resolver';
|
||||
import {ViewContainerRef} from './view_container_ref';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
import {isBlank} from '../facade/lang';
|
||||
|
||||
import {AppElement} from './element';
|
||||
import {ElementRef} from './element_ref';
|
||||
import {AppView} from './view';
|
||||
|
|
|
@ -7,27 +7,21 @@
|
|||
*/
|
||||
|
||||
import {ObservableWrapper} from '../facade/async';
|
||||
import {ListWrapper, Map, MapWrapper, StringMapWrapper} from '../facade/collection';
|
||||
import {Type, isArray, isBlank, isNumber, isPresent, isPrimitive, isString, stringify} from '../facade/lang';
|
||||
import {RenderComponentType, RenderDebugInfo, Renderer, RootRenderer} from '../render/api';
|
||||
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {RenderComponentType, RenderDebugInfo, Renderer} from '../render/api';
|
||||
import {AppElement} from './element';
|
||||
import {ViewRef_} from './view_ref';
|
||||
import {ViewType} from './view_type';
|
||||
import {ViewUtils, arrayLooseIdentical, ensureSlotCount, flattenNestedViewRenderNodes, mapLooseIdentical} from './view_utils';
|
||||
|
||||
import {ChangeDetectorRef, ChangeDetectionStrategy, ChangeDetectorStatus,} from '../change_detection/change_detection';
|
||||
import {ViewUtils, ensureSlotCount, flattenNestedViewRenderNodes} from './view_utils';
|
||||
import {ChangeDetectorRef, ChangeDetectorStatus,} from '../change_detection/change_detection';
|
||||
import {wtfCreateScope, wtfLeave, WtfScopeFn} from '../profile/profile';
|
||||
import {ExpressionChangedAfterItHasBeenCheckedException, ViewDestroyedException, ViewWrappedException} from './exceptions';
|
||||
import {StaticNodeDebugInfo, DebugContext} from './debug_context';
|
||||
import {ElementInjector} from './element_injector';
|
||||
import {Injector} from '../di/injector';
|
||||
|
||||
import {AUTO_STYLE} from '../animation/metadata';
|
||||
import {AnimationPlayer} from '../animation/animation_player';
|
||||
import {AnimationGroupPlayer} from '../animation/animation_group_player';
|
||||
import {AnimationKeyframe} from '../animation/animation_keyframe';
|
||||
import {AnimationStyles} from '../animation/animation_styles';
|
||||
import {ViewAnimationMap} from '../animation/view_animation_map';
|
||||
|
||||
var _scope_check: WtfScopeFn = wtfCreateScope(`AppView#check(ascii id)`);
|
||||
|
@ -99,7 +93,7 @@ export abstract class AppView<T> {
|
|||
create(context: T, givenProjectableNodes: Array<any|any[]>, rootSelectorOrNode: string|any):
|
||||
AppElement {
|
||||
this.context = context;
|
||||
var projectableNodes: any /** TODO #9100 */;
|
||||
var projectableNodes: any[];
|
||||
switch (this.type) {
|
||||
case ViewType.COMPONENT:
|
||||
projectableNodes = ensureSlotCount(givenProjectableNodes, this.componentType.slotCount);
|
||||
|
@ -141,7 +135,7 @@ export abstract class AppView<T> {
|
|||
|
||||
selectOrCreateHostElement(
|
||||
elementName: string, rootSelectorOrNode: string|any, debugInfo: RenderDebugInfo): any {
|
||||
var hostElement: any /** TODO #9100 */;
|
||||
var hostElement: any;
|
||||
if (isPresent(rootSelectorOrNode)) {
|
||||
hostElement = this.renderer.selectRootElement(rootSelectorOrNode, debugInfo);
|
||||
} else {
|
||||
|
@ -405,7 +399,7 @@ export class DebugAppView<T> extends AppView<T> {
|
|||
|
||||
eventHandler(cb: Function): Function {
|
||||
var superHandler = super.eventHandler(cb);
|
||||
return (event: any /** TODO #9100 */) => {
|
||||
return (event: any) => {
|
||||
this._resetDebug();
|
||||
try {
|
||||
return superHandler(event);
|
||||
|
@ -418,7 +412,7 @@ export class DebugAppView<T> extends AppView<T> {
|
|||
}
|
||||
|
||||
function _findLastRenderNode(node: any): any {
|
||||
var lastNode: any /** TODO #9100 */;
|
||||
var lastNode: any;
|
||||
if (node instanceof AppElement) {
|
||||
var appEl = <AppElement>node;
|
||||
lastNode = appEl.nativeElement;
|
||||
|
|
|
@ -11,7 +11,6 @@ import {ListWrapper} from '../facade/collection';
|
|||
import {unimplemented} from '../facade/exceptions';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {WtfScopeFn, wtfCreateScope, wtfLeave} from '../profile/profile';
|
||||
|
||||
import {ComponentFactory, ComponentRef} from './component_factory';
|
||||
import {AppElement} from './element';
|
||||
import {ElementRef} from './element_ref';
|
||||
|
|
|
@ -7,12 +7,10 @@
|
|||
*/
|
||||
|
||||
import {ChangeDetectorRef} from '../change_detection/change_detector_ref';
|
||||
import {ChangeDetectionStrategy, ChangeDetectorStatus} from '../change_detection/constants';
|
||||
import {ChangeDetectorStatus} from '../change_detection/constants';
|
||||
import {unimplemented} from '../facade/exceptions';
|
||||
|
||||
import {AppView} from './view';
|
||||
|
||||
|
||||
/**
|
||||
* @stable
|
||||
*/
|
||||
|
@ -84,7 +82,7 @@ export abstract class EmbeddedViewRef<C> extends ViewRef {
|
|||
/**
|
||||
* Destroys the view and all of the data structures associated with it.
|
||||
*/
|
||||
abstract destroy(): any /** TODO #9100 */;
|
||||
abstract destroy(): void;
|
||||
}
|
||||
|
||||
export class ViewRef_<C> implements EmbeddedViewRef<C>, ChangeDetectorRef {
|
||||
|
|
|
@ -10,13 +10,12 @@ import {APP_ID} from '../application_tokens';
|
|||
import {devModeEqual} from '../change_detection/change_detection';
|
||||
import {UNINITIALIZED} from '../change_detection/change_detection_util';
|
||||
import {Inject, Injectable} from '../di/decorators';
|
||||
import {ListWrapper, StringMapWrapper} from '../facade/collection';
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {isBlank, isPresent, looseIdentical} from '../facade/lang';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {RenderComponentType, Renderer, RootRenderer} from '../render/api';
|
||||
import {SanitizationService} from '../security';
|
||||
|
||||
import {AppElement} from './element';
|
||||
import {ExpressionChangedAfterItHasBeenCheckedException} from './exceptions';
|
||||
|
||||
|
@ -71,10 +70,10 @@ function _flattenNestedViewRenderNodes(nodes: any[], renderNodes: any[]): any[]
|
|||
return renderNodes;
|
||||
}
|
||||
|
||||
const EMPTY_ARR: any[] /** TODO #9100 */ = /*@ts2dart_const*/[];
|
||||
const EMPTY_ARR: any[] = /*@ts2dart_const*/[];
|
||||
|
||||
export function ensureSlotCount(projectableNodes: any[][], expectedSlotCount: number): any[][] {
|
||||
var res: any /** TODO #9100 */;
|
||||
var res: any[][];
|
||||
if (isBlank(projectableNodes)) {
|
||||
res = EMPTY_ARR;
|
||||
} else if (projectableNodes.length < expectedSlotCount) {
|
||||
|
@ -144,41 +143,17 @@ export function checkBinding(throwOnChange: boolean, oldValue: any, newValue: an
|
|||
}
|
||||
}
|
||||
|
||||
export function arrayLooseIdentical(a: any[], b: any[]): boolean {
|
||||
if (a.length != b.length) return false;
|
||||
for (var i = 0; i < a.length; ++i) {
|
||||
if (!looseIdentical(a[i], b[i])) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function mapLooseIdentical<V>(m1: {[key: string]: V}, m2: {[key: string]: V}): boolean {
|
||||
var k1 = StringMapWrapper.keys(m1);
|
||||
var k2 = StringMapWrapper.keys(m2);
|
||||
if (k1.length != k2.length) {
|
||||
return false;
|
||||
}
|
||||
var key: any /** TODO #9100 */;
|
||||
for (var i = 0; i < k1.length; i++) {
|
||||
key = k1[i];
|
||||
if (!looseIdentical(m1[key], m2[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function castByValue<T>(input: any, value: T): T {
|
||||
return <T>input;
|
||||
}
|
||||
|
||||
export const EMPTY_ARRAY: any[] /** TODO #9100 */ = /*@ts2dart_const*/[];
|
||||
export const EMPTY_MAP = /*@ts2dart_const*/ {};
|
||||
export const EMPTY_ARRAY: any[] = [];
|
||||
export const EMPTY_MAP = {};
|
||||
|
||||
export function pureProxy1<P0, R>(fn: (p0: P0) => R): (p0: P0) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */;
|
||||
v0 = UNINITIALIZED;
|
||||
let result: R;
|
||||
let v0: any = UNINITIALIZED;
|
||||
|
||||
return (p0) => {
|
||||
if (!looseIdentical(v0, p0)) {
|
||||
v0 = p0;
|
||||
|
@ -189,9 +164,10 @@ export function pureProxy1<P0, R>(fn: (p0: P0) => R): (p0: P0) => R {
|
|||
}
|
||||
|
||||
export function pureProxy2<P0, P1, R>(fn: (p0: P0, p1: P1) => R): (p0: P0, p1: P1) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */;
|
||||
v0 = v1 = UNINITIALIZED;
|
||||
let result: R;
|
||||
let v0: any = UNINITIALIZED;
|
||||
let v1: any = UNINITIALIZED;
|
||||
|
||||
return (p0, p1) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1)) {
|
||||
v0 = p0;
|
||||
|
@ -204,9 +180,11 @@ export function pureProxy2<P0, P1, R>(fn: (p0: P0, p1: P1) => R): (p0: P0, p1: P
|
|||
|
||||
export function pureProxy3<P0, P1, P2, R>(fn: (p0: P0, p1: P1, p2: P2) => R): (
|
||||
p0: P0, p1: P1, p2: P2) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */;
|
||||
v0 = v1 = v2 = UNINITIALIZED;
|
||||
let result: R;
|
||||
let v0: any = UNINITIALIZED;
|
||||
let v1: any = UNINITIALIZED;
|
||||
let v2: any = UNINITIALIZED;
|
||||
|
||||
return (p0, p1, p2) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2)) {
|
||||
v0 = p0;
|
||||
|
@ -220,9 +198,8 @@ export function pureProxy3<P0, P1, P2, R>(fn: (p0: P0, p1: P1, p2: P2) => R): (
|
|||
|
||||
export function pureProxy4<P0, P1, P2, P3, R>(fn: (p0: P0, p1: P1, p2: P2, p3: P3) => R): (
|
||||
p0: P0, p1: P1, p2: P2, p3: P3) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */;
|
||||
let result: R;
|
||||
let v0: any, v1: any, v2: any, v3: any;
|
||||
v0 = v1 = v2 = v3 = UNINITIALIZED;
|
||||
return (p0, p1, p2, p3) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
|
@ -240,9 +217,8 @@ export function pureProxy4<P0, P1, P2, P3, R>(fn: (p0: P0, p1: P1, p2: P2, p3: P
|
|||
export function pureProxy5<P0, P1, P2, P3, P4, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) =>
|
||||
R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */;
|
||||
let result: R;
|
||||
let v0: any, v1: any, v2: any, v3: any, v4: any;
|
||||
v0 = v1 = v2 = v3 = v4 = UNINITIALIZED;
|
||||
return (p0, p1, p2, p3, p4) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
|
@ -262,9 +238,8 @@ export function pureProxy5<P0, P1, P2, P3, P4, R>(
|
|||
export function pureProxy6<P0, P1, P2, P3, P4, P5, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) =>
|
||||
R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */;
|
||||
let result: R;
|
||||
let v0: any, v1: any, v2: any, v3: any, v4: any, v5: any;
|
||||
v0 = v1 = v2 = v3 = v4 = v5 = UNINITIALIZED;
|
||||
return (p0, p1, p2, p3, p4, p5) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
|
@ -284,10 +259,8 @@ export function pureProxy6<P0, P1, P2, P3, P4, P5, R>(
|
|||
export function pureProxy7<P0, P1, P2, P3, P4, P5, P6, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) =>
|
||||
R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */,
|
||||
v6: any /** TODO #9100 */;
|
||||
let result: R;
|
||||
let v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any;
|
||||
v0 = v1 = v2 = v3 = v4 = v5 = v6 = UNINITIALIZED;
|
||||
return (p0, p1, p2, p3, p4, p5, p6) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
|
@ -309,10 +282,8 @@ export function pureProxy7<P0, P1, P2, P3, P4, P5, P6, R>(
|
|||
export function pureProxy8<P0, P1, P2, P3, P4, P5, P6, P7, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) =>
|
||||
R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */,
|
||||
v6: any /** TODO #9100 */, v7: any /** TODO #9100 */;
|
||||
let result: R;
|
||||
let v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any;
|
||||
v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = UNINITIALIZED;
|
||||
return (p0, p1, p2, p3, p4, p5, p6, p7) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
|
@ -335,10 +306,8 @@ export function pureProxy8<P0, P1, P2, P3, P4, P5, P6, P7, R>(
|
|||
export function pureProxy9<P0, P1, P2, P3, P4, P5, P6, P7, P8, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8) =>
|
||||
R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */,
|
||||
v6: any /** TODO #9100 */, v7: any /** TODO #9100 */, v8: any /** TODO #9100 */;
|
||||
let result: R;
|
||||
let v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any, v8: any;
|
||||
v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = UNINITIALIZED;
|
||||
return (p0, p1, p2, p3, p4, p5, p6, p7, p8) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
|
@ -362,11 +331,8 @@ export function pureProxy9<P0, P1, P2, P3, P4, P5, P6, P7, P8, R>(
|
|||
export function pureProxy10<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9) =>
|
||||
R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */,
|
||||
v6: any /** TODO #9100 */, v7: any /** TODO #9100 */, v8: any /** TODO #9100 */,
|
||||
v9: any /** TODO #9100 */;
|
||||
let result: R;
|
||||
let v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any, v8: any, v9: any;
|
||||
v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = v9 = UNINITIALIZED;
|
||||
return (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
|
|
|
@ -705,7 +705,7 @@ export declare class ElementRef {
|
|||
export declare abstract class EmbeddedViewRef<C> extends ViewRef {
|
||||
context: C;
|
||||
rootNodes: any[];
|
||||
abstract destroy(): any;
|
||||
abstract destroy(): void;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
|
|
Loading…
Reference in New Issue