fix(transformers): use BarbackMode instead of assertionEnabled to enable debug info generation
Closes #5245 Closes #5466
This commit is contained in:
parent
87ddc8fb6a
commit
7f3223bd2c
|
@ -41,6 +41,10 @@ class TransformerOptions {
|
||||||
/// as attributes on DOM elements, which may aid in application debugging.
|
/// as attributes on DOM elements, which may aid in application debugging.
|
||||||
final bool reflectPropertiesAsAttributes;
|
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
|
/// 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
|
/// Format of an item in the list: angular2/lib/src/common/directives.dart#CORE_DIRECTIVES
|
||||||
final List<String> platformDirectives;
|
final List<String> platformDirectives;
|
||||||
|
@ -71,7 +75,8 @@ class TransformerOptions {
|
||||||
this.mirrorMode,
|
this.mirrorMode,
|
||||||
this.initReflector,
|
this.initReflector,
|
||||||
this.annotationMatcher,
|
this.annotationMatcher,
|
||||||
{this.reflectPropertiesAsAttributes,
|
{this.genChangeDetectionDebugInfo,
|
||||||
|
this.reflectPropertiesAsAttributes,
|
||||||
this.platformDirectives,
|
this.platformDirectives,
|
||||||
this.inlineViews,
|
this.inlineViews,
|
||||||
this.lazyTransformers,
|
this.lazyTransformers,
|
||||||
|
@ -83,7 +88,8 @@ class TransformerOptions {
|
||||||
bool initReflector: true,
|
bool initReflector: true,
|
||||||
List<ClassDescriptor> customAnnotationDescriptors: const [],
|
List<ClassDescriptor> customAnnotationDescriptors: const [],
|
||||||
bool inlineViews: false,
|
bool inlineViews: false,
|
||||||
bool reflectPropertiesAsAttributes: true,
|
bool genChangeDetectionDebugInfo: false,
|
||||||
|
bool reflectPropertiesAsAttributes: false,
|
||||||
List<String> platformDirectives,
|
List<String> platformDirectives,
|
||||||
bool lazyTransformers: false,
|
bool lazyTransformers: false,
|
||||||
bool formatCode: false}) {
|
bool formatCode: false}) {
|
||||||
|
@ -94,6 +100,7 @@ class TransformerOptions {
|
||||||
: null;
|
: null;
|
||||||
return new TransformerOptions._internal(entryPoints, entryPointGlobs,
|
return new TransformerOptions._internal(entryPoints, entryPointGlobs,
|
||||||
modeName, mirrorMode, initReflector, annotationMatcher,
|
modeName, mirrorMode, initReflector, annotationMatcher,
|
||||||
|
genChangeDetectionDebugInfo: genChangeDetectionDebugInfo,
|
||||||
reflectPropertiesAsAttributes: reflectPropertiesAsAttributes,
|
reflectPropertiesAsAttributes: reflectPropertiesAsAttributes,
|
||||||
platformDirectives: platformDirectives,
|
platformDirectives: platformDirectives,
|
||||||
inlineViews: inlineViews,
|
inlineViews: inlineViews,
|
||||||
|
|
|
@ -38,6 +38,7 @@ TransformerOptions parseBarbackSettings(BarbackSettings settings) {
|
||||||
modeName: settings.mode.name,
|
modeName: settings.mode.name,
|
||||||
mirrorMode: mirrorMode,
|
mirrorMode: mirrorMode,
|
||||||
initReflector: initReflector,
|
initReflector: initReflector,
|
||||||
|
genChangeDetectionDebugInfo: settings.mode == BarbackMode.DEBUG,
|
||||||
customAnnotationDescriptors: _readCustomAnnotations(config),
|
customAnnotationDescriptors: _readCustomAnnotations(config),
|
||||||
reflectPropertiesAsAttributes: reflectPropertiesAsAttributes,
|
reflectPropertiesAsAttributes: reflectPropertiesAsAttributes,
|
||||||
platformDirectives: platformDirectives,
|
platformDirectives: platformDirectives,
|
||||||
|
|
|
@ -28,7 +28,8 @@ import 'compile_data_creator.dart';
|
||||||
///
|
///
|
||||||
/// This method assumes a {@link DomAdapter} has been registered.
|
/// This method assumes a {@link DomAdapter} has been registered.
|
||||||
Future<Outputs> processTemplates(AssetReader reader, AssetId assetId,
|
Future<Outputs> processTemplates(AssetReader reader, AssetId assetId,
|
||||||
{bool reflectPropertiesAsAttributes: false,
|
{bool genChangeDetectionDebugInfo: false,
|
||||||
|
bool reflectPropertiesAsAttributes: false,
|
||||||
List<String> platformDirectives}) async {
|
List<String> platformDirectives}) async {
|
||||||
var viewDefResults =
|
var viewDefResults =
|
||||||
await createCompileData(reader, assetId, platformDirectives);
|
await createCompileData(reader, assetId, platformDirectives);
|
||||||
|
@ -48,7 +49,7 @@ Future<Outputs> processTemplates(AssetReader reader, AssetId assetId,
|
||||||
if (templateCompiler == null) {
|
if (templateCompiler == null) {
|
||||||
templateCompiler = createTemplateCompiler(reader,
|
templateCompiler = createTemplateCompiler(reader,
|
||||||
changeDetectionConfig: new ChangeDetectorGenConfig(
|
changeDetectionConfig: new ChangeDetectorGenConfig(
|
||||||
assertionsEnabled(), reflectPropertiesAsAttributes, false));
|
genChangeDetectionDebugInfo, reflectPropertiesAsAttributes, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
final compileData =
|
final compileData =
|
||||||
|
|
|
@ -44,6 +44,7 @@ class TemplateCompiler extends Transformer implements LazyTransformer {
|
||||||
var primaryId = transform.primaryInput.id;
|
var primaryId = transform.primaryInput.id;
|
||||||
var reader = new AssetReader.fromTransform(transform);
|
var reader = new AssetReader.fromTransform(transform);
|
||||||
var outputs = await processTemplates(reader, primaryId,
|
var outputs = await processTemplates(reader, primaryId,
|
||||||
|
genChangeDetectionDebugInfo: options.genChangeDetectionDebugInfo,
|
||||||
reflectPropertiesAsAttributes: options.reflectPropertiesAsAttributes,
|
reflectPropertiesAsAttributes: options.reflectPropertiesAsAttributes,
|
||||||
platformDirectives: options.platformDirectives);
|
platformDirectives: options.platformDirectives);
|
||||||
var ngDepsCode = _emptyNgDepsContents;
|
var ngDepsCode = _emptyNgDepsContents;
|
||||||
|
|
Loading…
Reference in New Issue