refactor: rename ComponentRenderTypeV2
to RendererTypeV2
This commit is contained in:
@ -223,10 +223,7 @@ export class AotCompiler {
|
||||
}
|
||||
compiledAnimations.forEach(entry => targetStatements.push(...entry.statements));
|
||||
targetStatements.push(...viewResult.statements);
|
||||
return {
|
||||
viewClassVar: viewResult.viewClassVar,
|
||||
compRenderTypeVar: viewResult.componentRenderTypeVar
|
||||
};
|
||||
return {viewClassVar: viewResult.viewClassVar, compRenderTypeVar: viewResult.rendererTypeVar};
|
||||
}
|
||||
|
||||
private _codgenStyles(
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ChangeDetectionStrategy, ComponentFactory, ComponentRenderTypeV2, SchemaMetadata, Type, ViewEncapsulation} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, ComponentFactory, RendererTypeV2, SchemaMetadata, Type, ViewEncapsulation} from '@angular/core';
|
||||
|
||||
import {StaticSymbol} from './aot/static_symbol';
|
||||
import {ListWrapper} from './facade/collection';
|
||||
@ -117,7 +117,7 @@ export function viewClassName(compType: any, embeddedTemplateIndex: number): str
|
||||
return `View_${identifierName({reference: compType})}_${embeddedTemplateIndex}`;
|
||||
}
|
||||
|
||||
export function componentRenderTypeName(compType: any): string {
|
||||
export function rendererTypeName(compType: any): string {
|
||||
return `RenderType_${identifierName({reference: compType})}`;
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ export interface CompileDirectiveSummary extends CompileTypeSummary {
|
||||
template: CompileTemplateSummary;
|
||||
wrapperType: StaticSymbol|ProxyClass;
|
||||
componentViewType: StaticSymbol|ProxyClass;
|
||||
componentRenderType: StaticSymbol|ComponentRenderTypeV2;
|
||||
rendererType: StaticSymbol|RendererTypeV2;
|
||||
componentFactory: StaticSymbol|ComponentFactory<any>;
|
||||
}
|
||||
|
||||
@ -326,7 +326,7 @@ export class CompileDirectiveMetadata {
|
||||
static create(
|
||||
{isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, host,
|
||||
providers, viewProviders, queries, viewQueries, entryComponents, template, wrapperType,
|
||||
componentViewType, componentRenderType, componentFactory}: {
|
||||
componentViewType, rendererType, componentFactory}: {
|
||||
isHost?: boolean,
|
||||
type?: CompileTypeMetadata,
|
||||
isComponent?: boolean,
|
||||
@ -344,7 +344,7 @@ export class CompileDirectiveMetadata {
|
||||
template?: CompileTemplateMetadata,
|
||||
wrapperType?: StaticSymbol|ProxyClass,
|
||||
componentViewType?: StaticSymbol|ProxyClass,
|
||||
componentRenderType?: StaticSymbol|ComponentRenderTypeV2,
|
||||
rendererType?: StaticSymbol|RendererTypeV2,
|
||||
componentFactory?: StaticSymbol|ComponentFactory<any>,
|
||||
} = {}): CompileDirectiveMetadata {
|
||||
const hostListeners: {[key: string]: string} = {};
|
||||
@ -399,7 +399,7 @@ export class CompileDirectiveMetadata {
|
||||
template,
|
||||
wrapperType,
|
||||
componentViewType,
|
||||
componentRenderType,
|
||||
rendererType,
|
||||
componentFactory,
|
||||
});
|
||||
}
|
||||
@ -424,13 +424,13 @@ export class CompileDirectiveMetadata {
|
||||
|
||||
wrapperType: StaticSymbol|ProxyClass;
|
||||
componentViewType: StaticSymbol|ProxyClass;
|
||||
componentRenderType: StaticSymbol|ComponentRenderTypeV2;
|
||||
rendererType: StaticSymbol|RendererTypeV2;
|
||||
componentFactory: StaticSymbol|ComponentFactory<any>;
|
||||
|
||||
constructor({isHost, type, isComponent, selector, exportAs,
|
||||
changeDetection, inputs, outputs, hostListeners, hostProperties,
|
||||
hostAttributes, providers, viewProviders, queries, viewQueries,
|
||||
entryComponents, template, wrapperType, componentViewType, componentRenderType,
|
||||
entryComponents, template, wrapperType, componentViewType, rendererType,
|
||||
componentFactory}: {
|
||||
isHost?: boolean,
|
||||
type?: CompileTypeMetadata,
|
||||
@ -451,7 +451,7 @@ export class CompileDirectiveMetadata {
|
||||
template?: CompileTemplateMetadata,
|
||||
wrapperType?: StaticSymbol|ProxyClass,
|
||||
componentViewType?: StaticSymbol|ProxyClass,
|
||||
componentRenderType?: StaticSymbol|ComponentRenderTypeV2,
|
||||
rendererType?: StaticSymbol|RendererTypeV2,
|
||||
componentFactory?: StaticSymbol|ComponentFactory<any>,
|
||||
} = {}) {
|
||||
this.isHost = !!isHost;
|
||||
@ -474,7 +474,7 @@ export class CompileDirectiveMetadata {
|
||||
|
||||
this.wrapperType = wrapperType;
|
||||
this.componentViewType = componentViewType;
|
||||
this.componentRenderType = componentRenderType;
|
||||
this.rendererType = rendererType;
|
||||
this.componentFactory = componentFactory;
|
||||
}
|
||||
|
||||
@ -499,7 +499,7 @@ export class CompileDirectiveMetadata {
|
||||
template: this.template && this.template.toSummary(),
|
||||
wrapperType: this.wrapperType,
|
||||
componentViewType: this.componentViewType,
|
||||
componentRenderType: this.componentRenderType,
|
||||
rendererType: this.rendererType,
|
||||
componentFactory: this.componentFactory
|
||||
};
|
||||
}
|
||||
@ -535,8 +535,7 @@ export function createHostComponentMeta(
|
||||
queries: [],
|
||||
viewQueries: [],
|
||||
componentViewType: hostViewType,
|
||||
componentRenderType:
|
||||
{id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {}}
|
||||
rendererType: {id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {}}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ANALYZE_FOR_ENTRY_COMPONENTS, ChangeDetectionStrategy, ChangeDetectorRef, ComponentFactory, ComponentFactoryResolver, ComponentRef, ComponentRenderTypeV2, ElementRef, Injector, LOCALE_ID, NgModuleFactory, QueryList, RenderComponentType, Renderer, SecurityContext, SimpleChange, TRANSLATIONS_FORMAT, TemplateRef, ViewContainerRef, ViewEncapsulation, ɵAnimationGroupPlayer, ɵAnimationKeyframe, ɵAnimationSequencePlayer, ɵAnimationStyles, ɵAnimationTransition, ɵAppView, ɵChangeDetectorStatus, ɵCodegenComponentFactoryResolver, ɵComponentRef_, ɵDebugAppView, ɵDebugContext, ɵNgModuleInjector, ɵNoOpAnimationPlayer, ɵStaticNodeDebugInfo, ɵTemplateRef_, ɵValueUnwrapper, ɵViewContainer, ɵViewType, ɵbalanceAnimationKeyframes, ɵclearStyles, ɵcollectAndResolveStyles, ɵdevModeEqual, ɵprepareFinalAnimationStyles, ɵreflector, ɵregisterModuleFactory, ɵrenderStyles, ɵviewEngine, ɵview_utils} from '@angular/core';
|
||||
import {ANALYZE_FOR_ENTRY_COMPONENTS, ChangeDetectionStrategy, ChangeDetectorRef, ComponentFactory, ComponentFactoryResolver, ComponentRef, ElementRef, Injector, LOCALE_ID, NgModuleFactory, QueryList, RenderComponentType, Renderer, RendererTypeV2, SecurityContext, SimpleChange, TRANSLATIONS_FORMAT, TemplateRef, ViewContainerRef, ViewEncapsulation, ɵAnimationGroupPlayer, ɵAnimationKeyframe, ɵAnimationSequencePlayer, ɵAnimationStyles, ɵAnimationTransition, ɵAppView, ɵChangeDetectorStatus, ɵCodegenComponentFactoryResolver, ɵComponentRef_, ɵDebugAppView, ɵDebugContext, ɵNgModuleInjector, ɵNoOpAnimationPlayer, ɵStaticNodeDebugInfo, ɵTemplateRef_, ɵValueUnwrapper, ɵViewContainer, ɵViewType, ɵbalanceAnimationKeyframes, ɵclearStyles, ɵcollectAndResolveStyles, ɵdevModeEqual, ɵprepareFinalAnimationStyles, ɵreflector, ɵregisterModuleFactory, ɵrenderStyles, ɵviewEngine, ɵview_utils} from '@angular/core';
|
||||
|
||||
import {CompileIdentifierMetadata, CompileTokenMetadata} from './compile_metadata';
|
||||
|
||||
@ -380,11 +380,11 @@ export class Identifiers {
|
||||
member: 'unwrapValue',
|
||||
runtime: ɵviewEngine.unwrapValue
|
||||
};
|
||||
static createComponentRenderTypeV2: IdentifierSpec = {
|
||||
static createRendererTypeV2: IdentifierSpec = {
|
||||
name: 'ɵviewEngine',
|
||||
moduleUrl: CORE,
|
||||
member: 'createComponentRenderTypeV2',
|
||||
runtime: ɵviewEngine.createComponentRenderTypeV2
|
||||
member: 'createRendererTypeV2',
|
||||
runtime: ɵviewEngine.createRendererTypeV2
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Compiler, ComponentFactory, ComponentRenderTypeV2, Inject, Injector, ModuleWithComponentFactories, NgModuleFactory, Type} from '@angular/core';
|
||||
import {Compiler, ComponentFactory, Inject, Injector, ModuleWithComponentFactories, NgModuleFactory, RendererTypeV2, Type} from '@angular/core';
|
||||
|
||||
import {AnimationCompiler} from '../animation/animation_compiler';
|
||||
import {AnimationParser} from '../animation/animation_parser';
|
||||
@ -290,18 +290,17 @@ export class JitCompiler implements Compiler {
|
||||
.concat(...compiledAnimations.map(ca => ca.statements))
|
||||
.concat(compileResult.statements);
|
||||
let viewClass: any;
|
||||
let componentRenderType: any;
|
||||
let rendererType: any;
|
||||
if (!this._compilerConfig.useJit) {
|
||||
[viewClass, componentRenderType] = interpretStatements(
|
||||
statements, [compileResult.viewClassVar, compileResult.componentRenderTypeVar]);
|
||||
[viewClass, rendererType] = interpretStatements(
|
||||
statements, [compileResult.viewClassVar, compileResult.rendererTypeVar]);
|
||||
} else {
|
||||
const sourceUrl =
|
||||
`/${identifierName(template.ngModule.type)}/${identifierName(template.compType)}/${template.isHost?'host':'component'}.ngfactory.js`;
|
||||
[viewClass, componentRenderType] = jitStatements(
|
||||
sourceUrl, statements,
|
||||
[compileResult.viewClassVar, compileResult.componentRenderTypeVar]);
|
||||
[viewClass, rendererType] = jitStatements(
|
||||
sourceUrl, statements, [compileResult.viewClassVar, compileResult.rendererTypeVar]);
|
||||
}
|
||||
template.compiled(viewClass, componentRenderType);
|
||||
template.compiled(viewClass, rendererType);
|
||||
}
|
||||
|
||||
private _resolveStylesCompileResult(
|
||||
@ -336,11 +335,11 @@ class CompiledTemplate {
|
||||
public compMeta: CompileDirectiveMetadata, public ngModule: CompileNgModuleMetadata,
|
||||
public directives: CompileIdentifierMetadata[]) {}
|
||||
|
||||
compiled(viewClass: Function, componentRenderType: any) {
|
||||
compiled(viewClass: Function, rendererType: any) {
|
||||
this._viewClass = viewClass;
|
||||
(<ProxyClass>this.compMeta.componentViewType).setDelegate(viewClass);
|
||||
for (let prop in componentRenderType) {
|
||||
(<any>this.compMeta.componentRenderType)[prop] = componentRenderType[prop];
|
||||
for (let prop in rendererType) {
|
||||
(<any>this.compMeta.rendererType)[prop] = rendererType[prop];
|
||||
}
|
||||
this.isCompiled = true;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {AnimationAnimateMetadata, AnimationEntryMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationStateDeclarationMetadata, AnimationStateMetadata, AnimationStateTransitionMetadata, AnimationStyleMetadata, AnimationWithStepsMetadata, Attribute, ChangeDetectionStrategy, Component, ComponentFactory, ComponentRenderTypeV2, Directive, Host, Inject, Injectable, InjectionToken, ModuleWithProviders, Optional, Provider, Query, SchemaMetadata, Self, SkipSelf, Type, resolveForwardRef} from '@angular/core';
|
||||
import {AnimationAnimateMetadata, AnimationEntryMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationStateDeclarationMetadata, AnimationStateMetadata, AnimationStateTransitionMetadata, AnimationStyleMetadata, AnimationWithStepsMetadata, Attribute, ChangeDetectionStrategy, Component, ComponentFactory, Directive, Host, Inject, Injectable, InjectionToken, ModuleWithProviders, Optional, Provider, Query, RendererTypeV2, SchemaMetadata, Self, SkipSelf, Type, resolveForwardRef} from '@angular/core';
|
||||
|
||||
import {StaticSymbol, StaticSymbolCache} from './aot/static_symbol';
|
||||
import {ngfactoryFilePath} from './aot/util';
|
||||
@ -131,10 +131,10 @@ export class CompileMetadataResolver {
|
||||
}
|
||||
}
|
||||
|
||||
private getComponentRenderType(dirType: any): StaticSymbol|ComponentRenderTypeV2 {
|
||||
private getRendererType(dirType: any): StaticSymbol|RendererTypeV2 {
|
||||
if (dirType instanceof StaticSymbol) {
|
||||
return this._staticSymbolCache.get(
|
||||
ngfactoryFilePath(dirType.filePath), cpl.componentRenderTypeName(dirType));
|
||||
ngfactoryFilePath(dirType.filePath), cpl.rendererTypeName(dirType));
|
||||
} else {
|
||||
// returning an object as proxy,
|
||||
// that we fill later during runtime compilation.
|
||||
@ -246,7 +246,7 @@ export class CompileMetadataResolver {
|
||||
entryComponents: metadata.entryComponents,
|
||||
wrapperType: metadata.wrapperType,
|
||||
componentViewType: metadata.componentViewType,
|
||||
componentRenderType: metadata.componentRenderType,
|
||||
rendererType: metadata.rendererType,
|
||||
componentFactory: metadata.componentFactory,
|
||||
template: templateMetadata
|
||||
});
|
||||
@ -384,8 +384,7 @@ export class CompileMetadataResolver {
|
||||
wrapperType: this.getDirectiveWrapperClass(directiveType),
|
||||
componentViewType: nonNormalizedTemplateMetadata ? this.getComponentViewClass(directiveType) :
|
||||
undefined,
|
||||
componentRenderType:
|
||||
nonNormalizedTemplateMetadata ? this.getComponentRenderType(directiveType) : undefined,
|
||||
rendererType: nonNormalizedTemplateMetadata ? this.getRendererType(directiveType) : undefined,
|
||||
componentFactory: nonNormalizedTemplateMetadata ?
|
||||
this.getComponentFactory(selector, directiveType) :
|
||||
undefined
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {AnimationEntryCompileResult} from '../animation/animation_compiler';
|
||||
import {CompileDirectiveMetadata, CompilePipeSummary, componentRenderTypeName, tokenName, viewClassName} from '../compile_metadata';
|
||||
import {CompileDirectiveMetadata, CompilePipeSummary, rendererTypeName, tokenName, viewClassName} from '../compile_metadata';
|
||||
import {EventHandlerVars, LegacyNameResolver} from '../compiler_util/expression_converter';
|
||||
import {CompilerConfig} from '../config';
|
||||
import {isPresent} from '../facade/lang';
|
||||
@ -70,7 +70,7 @@ export class CompileView implements LegacyNameResolver {
|
||||
public pipes: CompilePipe[] = [];
|
||||
public locals = new Map<string, o.Expression>();
|
||||
public className: string;
|
||||
public renderComponentTypeName: string;
|
||||
public rendererTypeName: string;
|
||||
public classType: o.Type;
|
||||
public classExpr: o.ReadVarExpr;
|
||||
|
||||
@ -103,7 +103,7 @@ export class CompileView implements LegacyNameResolver {
|
||||
|
||||
this.viewType = getViewType(component, viewIndex);
|
||||
this.className = viewClassName(component.type.reference, viewIndex);
|
||||
this.renderComponentTypeName = componentRenderTypeName(component.type.reference);
|
||||
this.rendererTypeName = rendererTypeName(component.type.reference);
|
||||
this.classType = o.expressionType(o.variable(this.className));
|
||||
this.classExpr = o.variable(this.className);
|
||||
if (this.viewType === ViewType.COMPONENT || this.viewType === ViewType.HOST) {
|
||||
|
@ -386,7 +386,7 @@ function createViewTopLevelStmts(view: CompileView, targetStatements: o.Statemen
|
||||
|
||||
|
||||
const renderCompTypeVar: o.ReadVarExpr =
|
||||
o.variable(view.renderComponentTypeName); // fix highlighting: `
|
||||
o.variable(view.rendererTypeName); // fix highlighting: `
|
||||
if (view.viewIndex === 0) {
|
||||
let templateUrlInfo: string;
|
||||
if (view.component.template.templateUrl == identifierModuleUrl(view.component.type)) {
|
||||
|
@ -24,8 +24,7 @@ export {ComponentFactoryDependency, ComponentViewDependency, DirectiveWrapperDep
|
||||
|
||||
export class ViewCompileResult {
|
||||
constructor(
|
||||
public statements: o.Statement[], public viewClassVar: string,
|
||||
public componentRenderTypeVar: string,
|
||||
public statements: o.Statement[], public viewClassVar: string, public rendererTypeVar: string,
|
||||
public dependencies:
|
||||
Array<ComponentViewDependency|ComponentFactoryDependency|DirectiveWrapperDependency>) {}
|
||||
}
|
||||
@ -52,6 +51,6 @@ export class ViewCompiler {
|
||||
finishView(view, statements);
|
||||
|
||||
return new ViewCompileResult(
|
||||
statements, view.classExpr.name, view.renderComponentTypeName, dependencies);
|
||||
statements, view.classExpr.name, view.rendererTypeName, dependencies);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
|
||||
|
||||
import {AnimationEntryCompileResult} from '../animation/animation_compiler';
|
||||
import {CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileDirectiveSummary, CompilePipeSummary, CompileProviderMetadata, CompileTokenMetadata, CompileTypeMetadata, componentRenderTypeName, identifierModuleUrl, identifierName, tokenReference, viewClassName} from '../compile_metadata';
|
||||
import {CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileDirectiveSummary, CompilePipeSummary, CompileProviderMetadata, CompileTokenMetadata, CompileTypeMetadata, identifierModuleUrl, identifierName, rendererTypeName, tokenReference, viewClassName} from '../compile_metadata';
|
||||
import {BuiltinConverter, BuiltinConverterFactory, EventHandlerVars, LocalResolver, convertActionBinding, convertPropertyBinding, convertPropertyBindingBuiltins} from '../compiler_util/expression_converter';
|
||||
import {CompilerConfig} from '../config';
|
||||
import {AST, ASTWithSource, Interpolation} from '../expression_parser/ast';
|
||||
@ -45,10 +45,10 @@ export class ViewCompilerNext extends ViewCompiler {
|
||||
|
||||
const statements: o.Statement[] = [];
|
||||
|
||||
const renderComponentVar = o.variable(componentRenderTypeName(component.type.reference));
|
||||
const renderComponentVar = o.variable(rendererTypeName(component.type.reference));
|
||||
statements.push(
|
||||
renderComponentVar
|
||||
.set(o.importExpr(createIdentifier(Identifiers.createComponentRenderTypeV2)).callFn([
|
||||
.set(o.importExpr(createIdentifier(Identifiers.createRendererTypeV2)).callFn([
|
||||
new o.LiteralMapExpr([
|
||||
new o.LiteralMapEntry('encapsulation', o.literal(component.template.encapsulation)),
|
||||
new o.LiteralMapEntry('styles', styles),
|
||||
@ -481,11 +481,11 @@ class ViewBuilder implements TemplateAstVisitor, LocalResolver, BuiltinConverter
|
||||
}
|
||||
});
|
||||
|
||||
let compRenderType = o.NULL_EXPR;
|
||||
let rendererType = o.NULL_EXPR;
|
||||
let compView = o.NULL_EXPR;
|
||||
if (directiveAst.directive.isComponent) {
|
||||
compView = o.importExpr({reference: directiveAst.directive.componentViewType});
|
||||
compRenderType = o.importExpr({reference: directiveAst.directive.componentRenderType});
|
||||
rendererType = o.importExpr({reference: directiveAst.directive.rendererType});
|
||||
}
|
||||
|
||||
const inputDefs = directiveAst.inputs.map((inputAst, inputIndex) => {
|
||||
@ -533,7 +533,7 @@ class ViewBuilder implements TemplateAstVisitor, LocalResolver, BuiltinConverter
|
||||
o.literal(flags), queryMatchExprs.length ? o.literalArr(queryMatchExprs) : o.NULL_EXPR,
|
||||
o.literal(childCount), providerExpr, depsExpr,
|
||||
inputDefs.length ? new o.LiteralMapExpr(inputDefs) : o.NULL_EXPR,
|
||||
outputDefs.length ? new o.LiteralMapExpr(outputDefs) : o.NULL_EXPR, compView, compRenderType
|
||||
outputDefs.length ? new o.LiteralMapExpr(outputDefs) : o.NULL_EXPR, compView, rendererType
|
||||
]);
|
||||
this.nodeDefs[nodeIndex] = nodeDef;
|
||||
|
||||
|
Reference in New Issue
Block a user