/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/compiler/src/render3/r3_injector_compiler.ts
44 строки
1 KB
Joey Perrott
refactor: update license text to point to angular.dev (#57901)
24 сен 2024, 16:33
24 сен 2024, 16:33
9dbe6fc
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import * as o from '../output/output_ast'; import {Identifiers as R3} from './r3_identifiers'; import {R3CompiledExpression, R3Reference} from './util'; import {DefinitionMap} from './view/util'; export interface R3InjectorMetadata { name: string; type: R3Reference; providers: o.Expression | null; imports: o.Expression[]; } export function compileInjector(meta: R3InjectorMetadata): R3CompiledExpression { const definitionMap = new DefinitionMap<{providers: o.Expression; imports: o.Expression}>(); if (meta.providers !== null) { definitionMap.set('providers', meta.providers); } if (meta.imports.length > 0) { definitionMap.set('imports', o.literalArr(meta.imports)); } const expression = o .importExpr(R3.defineInjector) .callFn([definitionMap.toLiteralMap()], undefined, true); const type = createInjectorType(meta); return {expression, type, statements: []}; } export function createInjectorType(meta: R3InjectorMetadata): o.Type { return new o.ExpressionType( o.importExpr(R3.InjectorDeclaration, [new o.ExpressionType(meta.type.type)]), ); }