Skip to content

Commit fd0ba37

Browse files
Tim Blasikegluneq
authored andcommitted
refactor(dart): Format Dart code
Use the dart formatter to clean up all pure Dart code. Closes angular#4832
1 parent 6be95ae commit fd0ba37

44 files changed

Lines changed: 326 additions & 258 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/angular2/angular2.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ library angular2;
55
*
66
* This library does not include `bootstrap`. Import `bootstrap.dart` instead.
77
*/
8-
export 'package:angular2/core.dart' hide forwardRef, resolveForwardRef, ForwardRefFn;
8+
export 'package:angular2/core.dart'
9+
hide forwardRef, resolveForwardRef, ForwardRefFn;
910
export 'package:angular2/profile.dart';
1011
export 'package:angular2/lifecycle_hooks.dart';
11-
export 'package:angular2/src/core/application_tokens.dart' hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_PROVIDER;
12+
export 'package:angular2/src/core/application_tokens.dart'
13+
hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_PROVIDER;
1214
export 'package:angular2/src/core/render/dom/dom_tokens.dart';

modules/angular2/core.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export 'package:angular2/src/core/pipes.dart';
88
export 'package:angular2/src/core/facade.dart';
99
// Do not export application for dart. Must import from angular2/bootstrap
1010
//export 'package:angular2/src/core/application.dart';
11-
export 'package:angular2/src/core/application_ref.dart' hide ApplicationRef_, PlatformRef_;
11+
export 'package:angular2/src/core/application_ref.dart'
12+
hide ApplicationRef_, PlatformRef_;
1213
export 'package:angular2/src/core/services.dart';
1314
export 'package:angular2/src/core/linker.dart';
1415
export 'package:angular2/src/core/lifecycle.dart';

modules/angular2/src/core/application.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import 'application_common.dart';
99

1010
import 'package:angular2/src/core/compiler/compiler.dart';
1111
import 'package:angular2/src/core/linker/dynamic_component_loader.dart';
12-
export 'package:angular2/src/core/linker/dynamic_component_loader.dart' show ComponentRef;
12+
export 'package:angular2/src/core/linker/dynamic_component_loader.dart'
13+
show ComponentRef;
1314

1415
/// Starts an application from a root component. This implementation uses
1516
/// mirrors. Angular 2 transformer automatically replaces this method with a

modules/angular2/src/core/application_static.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ library angular2.src.core.application_static;
22

33
import 'dart:async';
44
import 'application_common.dart';
5-
import 'package:angular2/src/core/linker/dynamic_component_loader.dart' show ComponentRef;
5+
import 'package:angular2/src/core/linker/dynamic_component_loader.dart'
6+
show ComponentRef;
67

78
/// Starts an application from a root component.
89
///

modules/angular2/src/core/change_detection/change_detection_jit_generator.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ library change_detection.change_detection_jit_generator;
88
/// `src/transform/template_compiler/change_detector_codegen.dart` for details.
99
class ChangeDetectorJITGenerator {
1010
String typeName;
11-
ChangeDetectorJITGenerator(definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) {}
11+
ChangeDetectorJITGenerator(
12+
definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) {}
1213

1314
generate() {
1415
throw "Jit Change Detection is not supported in Dart";

modules/angular2/src/core/change_detection/codegen_facade.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ String combineGeneratedStrings(List<String> vals) {
1616

1717
String rawString(String str) {
1818
return "r'$str'";
19-
}
19+
}

modules/angular2/src/core/change_detection/observable_facade.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ library change_detection.observable_facade;
22

33
import 'package:observe/observe.dart';
44

5-
bool isObservable(value) => value is Observable;
5+
bool isObservable(value) => value is Observable;

modules/angular2/src/core/dom/abstract_html_adapter.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,13 @@ abstract class AbstractHtml5LibAdapter implements DomAdapter {
340340
throw 'not implemented';
341341
}
342342

343-
bool isPageRule(rule) => (rule.type == 6);
343+
bool isPageRule(rule) => (rule.type == 6);
344344

345345
bool isStyleRule(rule) => (rule.type == 1);
346346

347347
bool isMediaRule(rule) => (rule.type == 4);
348348

349-
bool isKeyframesRule(rule) => (rule.type == 7);
349+
bool isKeyframesRule(rule) => (rule.type == 7);
350350

351351
String getHref(element) {
352352
throw 'not implemented';

modules/angular2/src/core/dom/browser_adapter.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ final _keyCodeToKeyMap = const {
9898
final bool _supportsTemplateElement = () {
9999
try {
100100
return new TemplateElement().content != null;
101-
} catch(_) {
101+
} catch (_) {
102102
return false;
103103
}
104104
}();
@@ -216,7 +216,8 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
216216
String nodeName(Node el) => el.nodeName;
217217
String nodeValue(Node el) => el.nodeValue;
218218
String type(InputElement el) => el.type;
219-
Node content(TemplateElement el) => _supportsTemplateElement ? el.content : el;
219+
Node content(TemplateElement el) =>
220+
_supportsTemplateElement ? el.content : el;
220221
Node firstChild(el) => el.firstChild;
221222
Node nextSibling(Node el) => el.nextNode;
222223
Element parentElement(Node el) => el.parent;
@@ -456,7 +457,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
456457
setGlobalVar(String path, value) {
457458
var parts = path.split('.');
458459
var obj = js.context;
459-
while(parts.length > 1) {
460+
while (parts.length > 1) {
460461
var name = parts.removeAt(0);
461462
if (obj.hasProperty(name)) {
462463
obj = obj[name];

modules/angular2/src/core/dom/emulated_css.dart

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,19 @@ List<EmulatedCssRule> parseAndEmulateCssRules(String css) {
1818

1919
/// Converts `csslib` [rules] to their emulated counterparts.
2020
List<EmulatedCssRule> emulateRules(Iterable<cssv.TreeNode> rules) {
21-
return rules
22-
.map((cssv.TreeNode node) {
23-
if (node is cssv.RuleSet) {
24-
if (node.declarationGroup.span.text.isEmpty) {
25-
// Skip CSS matchers with no bodies
26-
return null;
27-
}
28-
return new EmulatedCssStyleRule(node);
29-
} else if (node is cssv.MediaDirective) {
30-
return new EmulatedCssMedialRule(node);
31-
} else if (node is cssv.ImportDirective) {
32-
return new EmulatedCssImportRule(node);
21+
return rules.map((cssv.TreeNode node) {
22+
if (node is cssv.RuleSet) {
23+
if (node.declarationGroup.span.text.isEmpty) {
24+
// Skip CSS matchers with no bodies
25+
return null;
3326
}
34-
})
35-
.where((r) => r != null)
36-
.toList();
27+
return new EmulatedCssStyleRule(node);
28+
} else if (node is cssv.MediaDirective) {
29+
return new EmulatedCssMedialRule(node);
30+
} else if (node is cssv.ImportDirective) {
31+
return new EmulatedCssImportRule(node);
32+
}
33+
}).where((r) => r != null).toList();
3734
}
3835

3936
/// Emulates [CSSRule](https://developer.mozilla.org/en-US/docs/Web/API/CSSRule)
@@ -98,8 +95,8 @@ class EmulatedMediaList {
9895
String mediaText;
9996

10097
EmulatedMediaList(cssv.MediaDirective directive) {
101-
this.mediaText = directive.mediaQueries
102-
.map((q) => q.span.text).join(' and ');
98+
this.mediaText =
99+
directive.mediaQueries.map((q) => q.span.text).join(' and ');
103100
}
104101
}
105102

0 commit comments

Comments
 (0)