fix(transformers): use BarbackMode instead of assertionEnabled to enable debug info generation

Closes #5245

Closes #5466
This commit is contained in:
vsavkin 2015-11-24 14:08:43 -08:00 committed by Victor Savkin
parent 87ddc8fb6a
commit 7f3223bd2c
4 changed files with 14 additions and 4 deletions

View File

@ -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<String> 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<ClassDescriptor> customAnnotationDescriptors: const [],
bool inlineViews: false,
bool reflectPropertiesAsAttributes: true,
bool genChangeDetectionDebugInfo: false,
bool reflectPropertiesAsAttributes: false,
List<String> 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,

View File

@ -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,

View File

@ -28,7 +28,8 @@ import 'compile_data_creator.dart';
///
/// This method assumes a {@link DomAdapter} has been registered.
Future<Outputs> processTemplates(AssetReader reader, AssetId assetId,
{bool reflectPropertiesAsAttributes: false,
{bool genChangeDetectionDebugInfo: false,
bool reflectPropertiesAsAttributes: false,
List<String> platformDirectives}) async {
var viewDefResults =
await createCompileData(reader, assetId, platformDirectives);
@ -48,7 +49,7 @@ Future<Outputs> processTemplates(AssetReader reader, AssetId assetId,
if (templateCompiler == null) {
templateCompiler = createTemplateCompiler(reader,
changeDetectionConfig: new ChangeDetectorGenConfig(
assertionsEnabled(), reflectPropertiesAsAttributes, false));
genChangeDetectionDebugInfo, reflectPropertiesAsAttributes, false));
}
final compileData =

View File

@ -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;