From 17ce7d49bb95a3c5853538dec3da9a748accd7bb Mon Sep 17 00:00:00 2001 From: Rado Kirov Date: Fri, 16 Mar 2018 22:11:06 -0700 Subject: [PATCH] fix(compiler): do not emit line/char in ngsummary files. Having ngsummaries emit line/char numbers causes white space change to retrigger upstream recompilations. --- .../compiler/src/aot/summary_serializer.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/compiler/src/aot/summary_serializer.ts b/packages/compiler/src/aot/summary_serializer.ts index 195a58c737922..47d63cb6c5cd5 100644 --- a/packages/compiler/src/aot/summary_serializer.ts +++ b/packages/compiler/src/aot/summary_serializer.ts @@ -221,6 +221,24 @@ class ToJsonSerializer extends ValueTransformer { } } + /** + * Strip line and character numbers from ngsummaries. + * Emitting them causes white spaces changes to retrigger upstream + * recompilations in bazel. + * TODO: find out a way to have line and character numbers in errors without + * excessive recompilation in bazel. + */ + visitStringMap(map: {[key: string]: any}, context: any): any { + if (map['__symbolic'] === 'resolved') { + return visitValue(map.symbol, this, context); + } + if (map['__symbolic'] === 'error') { + delete map['line']; + delete map['character']; + } + return super.visitStringMap(map, context); + } + /** * Returns null if the options.resolveValue is true, and the summary for the symbol * resolved to a type or could not be resolved.