diff --git a/modules_dart/transform/lib/src/transform/common/options.dart b/modules_dart/transform/lib/src/transform/common/options.dart index f5d1e5038d..9be884274d 100644 --- a/modules_dart/transform/lib/src/transform/common/options.dart +++ b/modules_dart/transform/lib/src/transform/common/options.dart @@ -41,6 +41,10 @@ class TransformerOptions { /// as attributes on DOM elements, which may aid in application debugging. final bool reflectPropertiesAsAttributes; + /// Whether to generate debug information in change detectors. + /// This improves error messages when exception are triggered in templates. + final bool genChangeDetectionDebugInfo; + /// A set of directives that will be automatically passed-in to the template compiler /// Format of an item in the list: angular2/lib/src/common/directives.dart#CORE_DIRECTIVES final List platformDirectives; @@ -71,7 +75,8 @@ class TransformerOptions { this.mirrorMode, this.initReflector, this.annotationMatcher, - {this.reflectPropertiesAsAttributes, + {this.genChangeDetectionDebugInfo, + this.reflectPropertiesAsAttributes, this.platformDirectives, this.inlineViews, this.lazyTransformers, @@ -83,7 +88,8 @@ class TransformerOptions { bool initReflector: true, List customAnnotationDescriptors: const [], bool inlineViews: false, - bool reflectPropertiesAsAttributes: true, + bool genChangeDetectionDebugInfo: false, + bool reflectPropertiesAsAttributes: false, List platformDirectives, bool lazyTransformers: false, bool formatCode: false}) { @@ -94,6 +100,7 @@ class TransformerOptions { : null; return new TransformerOptions._internal(entryPoints, entryPointGlobs, modeName, mirrorMode, initReflector, annotationMatcher, + genChangeDetectionDebugInfo: genChangeDetectionDebugInfo, reflectPropertiesAsAttributes: reflectPropertiesAsAttributes, platformDirectives: platformDirectives, inlineViews: inlineViews, diff --git a/modules_dart/transform/lib/src/transform/common/options_reader.dart b/modules_dart/transform/lib/src/transform/common/options_reader.dart index 18d8566a4a..bd325c82e8 100644 --- a/modules_dart/transform/lib/src/transform/common/options_reader.dart +++ b/modules_dart/transform/lib/src/transform/common/options_reader.dart @@ -38,6 +38,7 @@ TransformerOptions parseBarbackSettings(BarbackSettings settings) { modeName: settings.mode.name, mirrorMode: mirrorMode, initReflector: initReflector, + genChangeDetectionDebugInfo: settings.mode == BarbackMode.DEBUG, customAnnotationDescriptors: _readCustomAnnotations(config), reflectPropertiesAsAttributes: reflectPropertiesAsAttributes, platformDirectives: platformDirectives, diff --git a/modules_dart/transform/lib/src/transform/template_compiler/generator.dart b/modules_dart/transform/lib/src/transform/template_compiler/generator.dart index 68e89badc3..960fbfc985 100644 --- a/modules_dart/transform/lib/src/transform/template_compiler/generator.dart +++ b/modules_dart/transform/lib/src/transform/template_compiler/generator.dart @@ -28,7 +28,8 @@ import 'compile_data_creator.dart'; /// /// This method assumes a {@link DomAdapter} has been registered. Future processTemplates(AssetReader reader, AssetId assetId, - {bool reflectPropertiesAsAttributes: false, + {bool genChangeDetectionDebugInfo: false, + bool reflectPropertiesAsAttributes: false, List platformDirectives}) async { var viewDefResults = await createCompileData(reader, assetId, platformDirectives); @@ -48,7 +49,7 @@ Future processTemplates(AssetReader reader, AssetId assetId, if (templateCompiler == null) { templateCompiler = createTemplateCompiler(reader, changeDetectionConfig: new ChangeDetectorGenConfig( - assertionsEnabled(), reflectPropertiesAsAttributes, false)); + genChangeDetectionDebugInfo, reflectPropertiesAsAttributes, false)); } final compileData = diff --git a/modules_dart/transform/lib/src/transform/template_compiler/transformer.dart b/modules_dart/transform/lib/src/transform/template_compiler/transformer.dart index b5069918c0..79281476aa 100644 --- a/modules_dart/transform/lib/src/transform/template_compiler/transformer.dart +++ b/modules_dart/transform/lib/src/transform/template_compiler/transformer.dart @@ -44,6 +44,7 @@ class TemplateCompiler extends Transformer implements LazyTransformer { var primaryId = transform.primaryInput.id; var reader = new AssetReader.fromTransform(transform); var outputs = await processTemplates(reader, primaryId, + genChangeDetectionDebugInfo: options.genChangeDetectionDebugInfo, reflectPropertiesAsAttributes: options.reflectPropertiesAsAttributes, platformDirectives: options.platformDirectives); var ngDepsCode = _emptyNgDepsContents;