parent
2d9111bfb6
commit
81c13e2f86
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ConstantPool, R3DirectiveMetadata, WrappedNodeExpr, compileComponentFromMetadata as compileIvyComponent, compileDirectiveFromMetadata as compileIvyDirective, jitExpression, makeBindingParser, parseTemplate} from '@angular/compiler';
|
import {ConstantPool, R3DirectiveMetadata, WrappedNodeExpr, compileComponentFromMetadata as compileR3Component, compileDirectiveFromMetadata as compileR3Directive, jitExpression, makeBindingParser, parseTemplate} from '@angular/compiler';
|
||||||
|
|
||||||
import {Component, Directive, HostBinding, Input, Output} from '../../metadata/directives';
|
import {Component, Directive, HostBinding, Input, Output} from '../../metadata/directives';
|
||||||
import {ReflectionCapabilities} from '../../reflection/reflection_capabilities';
|
import {ReflectionCapabilities} from '../../reflection/reflection_capabilities';
|
||||||
|
@ -49,7 +49,7 @@ export function compileComponent(type: Type<any>, metadata: Component): Promise<
|
||||||
|
|
||||||
// Compile the component metadata, including template, into an expression.
|
// Compile the component metadata, including template, into an expression.
|
||||||
// TODO(alxhub): implement inputs, outputs, queries, etc.
|
// TODO(alxhub): implement inputs, outputs, queries, etc.
|
||||||
const res = compileIvyComponent(
|
const res = compileR3Component(
|
||||||
{
|
{
|
||||||
...directiveMetadata(type, metadata),
|
...directiveMetadata(type, metadata),
|
||||||
template,
|
template,
|
||||||
|
@ -83,7 +83,7 @@ export function compileDirective(type: Type<any>, directive: Directive): Promise
|
||||||
if (def === null) {
|
if (def === null) {
|
||||||
const constantPool = new ConstantPool();
|
const constantPool = new ConstantPool();
|
||||||
const sourceMapUrl = `ng://${type && type.name}/ngDirectiveDef.js`;
|
const sourceMapUrl = `ng://${type && type.name}/ngDirectiveDef.js`;
|
||||||
const res = compileIvyDirective(
|
const res = compileR3Directive(
|
||||||
directiveMetadata(type, directive), constantPool, makeBindingParser());
|
directiveMetadata(type, directive), constantPool, makeBindingParser());
|
||||||
def = jitExpression(res.expression, angularCoreEnv, sourceMapUrl, constantPool);
|
def = jitExpression(res.expression, angularCoreEnv, sourceMapUrl, constantPool);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Expression, LiteralExpr, R3DependencyMetadata, WrappedNodeExpr, compileInjectable as compileIvyInjectable, jitExpression} from '@angular/compiler';
|
import {Expression, LiteralExpr, R3DependencyMetadata, WrappedNodeExpr, compileInjectable as compileR3Injectable, jitExpression} from '@angular/compiler';
|
||||||
|
|
||||||
import {Injectable} from '../../di/injectable';
|
import {Injectable} from '../../di/injectable';
|
||||||
import {ClassSansProvider, ExistingSansProvider, FactorySansProvider, StaticClassSansProvider, ValueProvider, ValueSansProvider} from '../../di/provider';
|
import {ClassSansProvider, ExistingSansProvider, FactorySansProvider, StaticClassSansProvider, ValueProvider, ValueSansProvider} from '../../di/provider';
|
||||||
|
@ -74,7 +74,7 @@ export function compileInjectable(type: Type<any>, meta?: Injectable): void {
|
||||||
throw new Error(`Unreachable state.`);
|
throw new Error(`Unreachable state.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const {expression} = compileIvyInjectable({
|
const {expression} = compileR3Injectable({
|
||||||
name: type.name,
|
name: type.name,
|
||||||
type: new WrappedNodeExpr(type),
|
type: new WrappedNodeExpr(type),
|
||||||
providedIn: computeProvidedIn(meta.providedIn),
|
providedIn: computeProvidedIn(meta.providedIn),
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Expression, R3NgModuleMetadata, WrappedNodeExpr, compileNgModule as compileIvyNgModule, jitExpression} from '@angular/compiler';
|
import {Expression, R3NgModuleMetadata, WrappedNodeExpr, compileNgModule as compileR3NgModule, jitExpression} from '@angular/compiler';
|
||||||
|
|
||||||
import {ModuleWithProviders, NgModule, NgModuleDef} from '../../metadata/ng_module';
|
import {ModuleWithProviders, NgModule, NgModuleDef} from '../../metadata/ng_module';
|
||||||
import {Type} from '../../type';
|
import {Type} from '../../type';
|
||||||
|
@ -76,7 +76,7 @@ export function compileNgModule(type: Type<any>, ngModule: NgModule): void {
|
||||||
flatten(ngModule.exports || EMPTY_ARRAY).map(expandModuleWithProviders).map(wrap),
|
flatten(ngModule.exports || EMPTY_ARRAY).map(expandModuleWithProviders).map(wrap),
|
||||||
emitInline: true,
|
emitInline: true,
|
||||||
};
|
};
|
||||||
const res = compileIvyNgModule(meta);
|
const res = compileR3NgModule(meta);
|
||||||
def = jitExpression(res.expression, angularCoreEnv, `ng://${type.name}/ngModuleDef.js`);
|
def = jitExpression(res.expression, angularCoreEnv, `ng://${type.name}/ngModuleDef.js`);
|
||||||
def.transitiveCompileScope = transitiveCompileScope;
|
def.transitiveCompileScope = transitiveCompileScope;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue