Skip to content

Commit

Permalink
refactor(compiler): rename diagnostics/src/code.ts to diagnostics/src…
Browse files Browse the repository at this point in the history
…/error_code.ts (angular#35067)

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

PR Close angular#35067
  • Loading branch information
IgorMinar authored and mhevery committed Jan 31, 2020
1 parent a4cacb5 commit c070037
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/ngtsc/diagnostics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

export {ErrorCode, ngErrorCode} from './src/code';
export {FatalDiagnosticError, isFatalDiagnosticError, makeDiagnostic} from './src/error';
export {ErrorCode, ngErrorCode} from './src/error_code';
export {replaceTsWithNgInErrors} from './src/util';
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/ngtsc/diagnostics/src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import * as ts from 'typescript';

import {ErrorCode} from './code';
import {ErrorCode} from './error_code';

export class FatalDiagnosticError {
constructor(readonly code: ErrorCode, readonly node: ts.Node, readonly message: string) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* found in the LICENSE file at https://angular.io/license
*/

/**
* @publicApi
*/
export enum ErrorCode {
DECORATOR_ARG_NOT_LITERAL = 1001,
DECORATOR_ARITY_WRONG = 1002,
Expand Down Expand Up @@ -125,6 +128,9 @@ export enum ErrorCode {
INJECTABLE_DUPLICATE_PROV = 9001,
}

/**
* @internal
*/
export function ngErrorCode(code: ErrorCode): number {
return parseInt('-99' + code);
}
2 changes: 1 addition & 1 deletion tools/public_api_guard/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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
ts_api_guardian_test(
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 = [
":error_code.d.ts",
"//packages/compiler-cli/src/ngtsc/diagnostics",
Expand Down

0 comments on commit c070037

Please sign in to comment.