X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions modules_dart/transform/lib/src/transform/common/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -71,7 +75,8 @@ class TransformerOptions {
this.mirrorMode,
this.initReflector,
this.annotationMatcher,
{this.reflectPropertiesAsAttributes,
{this.genChangeDetectionDebugInfo,
this.reflectPropertiesAsAttributes,
this.platformDirectives,
this.inlineViews,
this.lazyTransformers,
Expand All @@ -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}) {
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
X Tutup