refactor(compiler): rename diagnostics/src/code.ts to diagnostics/src/error_code.ts (#35067)

the new filename is less ambiguous and better reflects the name of the symbol defined in it.

PR Close #35067
This commit is contained in:
Igor Minar 2020-01-30 14:33:04 -08:00 committed by Misko Hevery
parent a4cacb55eb
commit c070037357
4 changed files with 9 additions and 3 deletions

View File

@ -6,6 +6,6 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
export {ErrorCode, ngErrorCode} from './src/code';
export {FatalDiagnosticError, isFatalDiagnosticError, makeDiagnostic} from './src/error'; export {FatalDiagnosticError, isFatalDiagnosticError, makeDiagnostic} from './src/error';
export {ErrorCode, ngErrorCode} from './src/error_code';
export {replaceTsWithNgInErrors} from './src/util'; export {replaceTsWithNgInErrors} from './src/util';

View File

@ -8,7 +8,7 @@
import * as ts from 'typescript'; import * as ts from 'typescript';
import {ErrorCode} from './code'; import {ErrorCode} from './error_code';
export class FatalDiagnosticError { export class FatalDiagnosticError {
constructor(readonly code: ErrorCode, readonly node: ts.Node, readonly message: string) {} constructor(readonly code: ErrorCode, readonly node: ts.Node, readonly message: string) {}

View File

@ -6,6 +6,9 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
/**
* @publicApi
*/
export enum ErrorCode { export enum ErrorCode {
DECORATOR_ARG_NOT_LITERAL = 1001, DECORATOR_ARG_NOT_LITERAL = 1001,
DECORATOR_ARITY_WRONG = 1002, DECORATOR_ARITY_WRONG = 1002,
@ -125,6 +128,9 @@ export enum ErrorCode {
INJECTABLE_DUPLICATE_PROV = 9001, INJECTABLE_DUPLICATE_PROV = 9001,
} }
/**
* @internal
*/
export function ngErrorCode(code: ErrorCode): number { export function ngErrorCode(code: ErrorCode): number {
return parseInt('-99' + code); return parseInt('-99' + code);
} }

View File

@ -69,7 +69,7 @@ ts_api_guardian_test(
# explicit target because the d.ts file is nested in the core and not part of typical public d.ts api # explicit target because the d.ts file is nested in the core and not part of typical public d.ts api
ts_api_guardian_test( ts_api_guardian_test(
name = "error_code_api", name = "error_code_api",
actual = "angular/packages/compiler-cli/src/ngtsc/diagnostics/src/code.d.ts", actual = "angular/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.d.ts",
data = [ data = [
":error_code.d.ts", ":error_code.d.ts",
"//packages/compiler-cli/src/ngtsc/diagnostics", "//packages/compiler-cli/src/ngtsc/diagnostics",