Skip to content

Commit

Permalink
Clarify in dev_compiler docs the reason for the angular whitelist hack
Browse files Browse the repository at this point in the history
Related to #27255

R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2772433002 .
  • Loading branch information
kevmoo committed Mar 22, 2017
1 parent 74d6957 commit 2340c8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
24 changes: 11 additions & 13 deletions pkg/dev_compiler/lib/src/compiler/code_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5872,24 +5872,22 @@ class CodeGenerator extends GeneralizingAstVisitor
return js.statement('#.$code', args);
}

// TODO(kevmoo): https://github.com/dart-lang/sdk/issues/27255
// TODO(kevmoo): Remove once pkg/angular2 has moved to the new compiler
// See https://github.com/dart-lang/angular2/issues/48
/// Temporary workaround *cough* total hack *cough*.
///
/// Maps whitelisted files to a list of whitelisted methods
/// within the file.
///
/// If the value is null, the entire file is whitelisted.
///
// TODO(jmesserly): why is this here, and what can we do to remove it?
//
// Hard coded lists are completely unnecessary -- if a feature is needed,
// metadata, type system features, or command line options are the right way
// to express it.
//
// As it is this is completely unsound and unmaintainable.
static Map<String, List<String>> _uncheckedWhitelist = {
'dom_renderer.dart': ['moveNodesAfterSibling'],
'template_ref.dart': ['createEmbeddedView'],
'ng_class.dart': ['_applyIterableChanges'],
'ng_for.dart': ['_bulkRemove', '_bulkInsert'],
'view_container_ref.dart': ['createEmbeddedView'],
static const Map<String, List<String>> _uncheckedWhitelist = const {
'dom_renderer.dart': const ['moveNodesAfterSibling'],
'template_ref.dart': const ['createEmbeddedView'],
'ng_class.dart': const ['_applyIterableChanges'],
'ng_for.dart': const ['_bulkRemove', '_bulkInsert'],
'view_container_ref.dart': const ['createEmbeddedView'],
'default_iterable_differ.dart': null,
};

Expand Down
4 changes: 4 additions & 0 deletions pkg/dev_compiler/lib/src/compiler/compiler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ class CompilerOptions {
/// Hoist types in type tests
final bool hoistTypeTests;

// TODO(kevmoo): Remove once https://github.com/dart-lang/sdk/issues/27255
// is fixed.
final bool useAngular2Whitelist;

/// Enable ES6 destructuring of named parameters. Off by default.
Expand Down Expand Up @@ -375,6 +377,8 @@ class CompilerOptions {
help: 'Name types used in type tests', defaultsTo: true, hide: hide)
..addFlag('hoist-type-tests',
help: 'Hoist types used in type tests', defaultsTo: true, hide: hide)
// TODO(kevmoo): Remove once https://github.com/dart-lang/sdk/issues/27255
// is fixed.
..addFlag('unsafe-angular2-whitelist', defaultsTo: false, hide: hide)
..addOption('bazel-mapping',
help:
Expand Down

0 comments on commit 2340c8f

Please sign in to comment.