refactor(ivy): move the expr/stmt translator to a separate target (#26203)

Template type-checking will make use of expression and statement
translation as well as the ImportManager, so this code needs to
live in a separate build target which can be depended on by both
the main ngtsc transform as well as the template type-checking
mechanism. This refactor introduces a separate build target
for that code.

PR Close #26203
This commit is contained in:
Alex Rickabaugh 2018-09-21 12:15:06 -07:00 committed by Jason Aden
parent 79466baef8
commit 4c615f7de7
9 changed files with 29 additions and 4 deletions

View File

@ -16,5 +16,6 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/host",
"//packages/compiler-cli/src/ngtsc/metadata",
"//packages/compiler-cli/src/ngtsc/transform",
"//packages/compiler-cli/src/ngtsc/translator",
],
)

View File

@ -14,7 +14,7 @@ import {SourceMapConsumer, SourceMapGenerator, RawSourceMap} from 'source-map';
import * as ts from 'typescript';
import {Decorator} from '../../../ngtsc/host';
import {ImportManager, translateStatement} from '../../../ngtsc/transform';
import {ImportManager, translateStatement} from '../../../ngtsc/translator';
import {AnalyzedClass, AnalyzedFile} from '../analyzer';
import {IMPORT_PREFIX} from '../constants';
import {NgccReflectionHost} from '../host/ngcc_host';

View File

@ -14,6 +14,7 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/diagnostics",
"//packages/compiler-cli/src/ngtsc/host",
"//packages/compiler-cli/src/ngtsc/metadata",
"//packages/compiler-cli/src/ngtsc/translator",
"//packages/compiler-cli/src/ngtsc/util",
],
)

View File

@ -10,4 +10,3 @@ export * from './src/api';
export {IvyCompilation} from './src/compilation';
export {DtsFileTransformer} from './src/declaration';
export {ivyTransformFactory} from './src/transform';
export {ImportManager, translateStatement} from './src/translator';

View File

@ -8,8 +8,9 @@
import * as ts from 'typescript';
import {ImportManager, translateType} from '../../translator';
import {CompileResult} from './api';
import {ImportManager, translateType} from './translator';

View File

@ -10,12 +10,12 @@ import {ConstantPool} from '@angular/compiler';
import * as ts from 'typescript';
import {Decorator, ReflectionHost} from '../../host';
import {ImportManager, translateExpression, translateStatement} from '../../translator';
import {relativePathBetween} from '../../util/src/path';
import {VisitListEntryResult, Visitor, visit} from '../../util/src/visitor';
import {CompileResult} from './api';
import {IvyCompilation} from './compilation';
import {ImportManager, translateExpression, translateStatement} from './translator';
const NO_DECORATORS = new Set<ts.Decorator>();

View File

@ -0,0 +1,14 @@
package(default_visibility = ["//visibility:public"])
load("//tools:defaults.bzl", "ts_library")
ts_library(
name = "translator",
srcs = glob(["**/*.ts"]),
module_name = "@angular/compiler-cli/src/ngtsc/translator",
deps = [
"//packages:types",
"//packages/compiler",
"//packages/compiler-cli/src/ngtsc/util",
],
)

View File

@ -0,0 +1,9 @@
/**
* @license
* Copyright Google Inc. 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.io/license
*/
export {ImportManager, translateExpression, translateStatement, translateType} from './src/translator';