Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Minor style updates #615

Closed
wants to merge 2 commits into from
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
4 changes: 2 additions & 2 deletions lib/change_detection/dirty_checking_change_detector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ class _CollectionChangeRecord<V> implements CollectionChangeRecord<V> {

if (collection is List) {
List list = collection;
for(int index = 0; index < list.length; index++) {
for (int index = 0; index < list.length; index++) {
var item = list[index];
if (record == null || !identical(item, record.item)) {
record = mismatch(record, item, index);
Expand All @@ -806,7 +806,7 @@ class _CollectionChangeRecord<V> implements CollectionChangeRecord<V> {
}
} else {
int index = 0;
for(var item in collection) {
for (var item in collection) {
if (record == null || !identical(item, record.item)) {
record = mismatch(record, item, index);
maybeDirty = true;
Expand Down
4 changes: 2 additions & 2 deletions lib/core/interpolate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Interpolation {
String call(List parts, [_]) {
if (parts == null) return seperators.join('');
var str = [];
for(var i = 0, ii = parts.length; i < ii; i++) {
for (var i = 0; i < parts.length; i++) {
str.add(seperators[i]);
var value = parts[i];
str.add(value == null ? '' : '$value');
Expand Down Expand Up @@ -47,7 +47,7 @@ class Interpolate {
* - `startSymbol`: The symbol to start interpolation. '{{' by default.
* - `endSymbol`: The symbol to end interpolation. '}}' by default.
*/
Interpolation call(String template, [bool mustHaveExpression = false,
Interpolation call(String template, [bool mustHaveExpression = false,
String startSymbol = '{{', String endSymbol = '}}']) {
int startSymbolLength = startSymbol.length;
int endSymbolLength = endSymbol.length;
Expand Down
2 changes: 1 addition & 1 deletion lib/core/parser/eval.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Chain extends syntax.Chain {
Chain(List<syntax.Expression> expressions) : super(expressions);
eval(scope, [FilterMap filters]) {
var result;
for (int i = 0, length = expressions.length; i < length; i++) {
for (int i = 0; i < expressions.length; i++) {
var last = expressions[i].eval(scope, filters);
if (last != null) result = last;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/core/parser/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class EvalError {
/// Evaluate the [list] in context of the [scope].
List evalList(scope, List<Expression> list, [FilterMap filters]) {
int length = list.length;
for(int cacheLength = _evalListCache.length; cacheLength <= length; cacheLength++) {
for (int cacheLength = _evalListCache.length; cacheLength <= length; cacheLength++) {
_evalListCache.add(new List(cacheLength));
}
List result = _evalListCache[length];
Expand Down
10 changes: 5 additions & 5 deletions lib/core/scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class Scope {
});
childScope = childScope._next;
}
if(!_mapEqual(counts, typeCounts)) {
if (!_mapEqual(counts, typeCounts)) {
throw 'Streams actual: $counts != bookkeeping: $typeCounts\n'
'Offending scope: [scope: ${this.hashCode}]\n'
'${log.join('')}';
Expand Down Expand Up @@ -585,7 +585,7 @@ class _Streams {
scope = queue.removeFirst();
scopeStreams = scope._streams;
assert(scopeStreams._scope == scope);
if(scopeStreams._streams.containsKey(name)) {
if (scopeStreams._streams.containsKey(name)) {
var stream = scopeStreams._streams[name];
event._currentScope = scope;
stream._fire(event);
Expand Down Expand Up @@ -702,7 +702,7 @@ class ScopeStream extends async.Stream<ScopeEvent> {
}

void _fire(ScopeEvent event) {
for(ScopeStreamSubscription subscription in subscriptions) {
for (ScopeStreamSubscription subscription in subscriptions) {
try {
subscription._onData(event);
} catch (e, s) {
Expand Down Expand Up @@ -844,7 +844,7 @@ class ExpressionVisitor implements Visitor {
List<AST> values = _toAst(exp.values);
assert(keys.length == values.length);
var kv = <String>[];
for(var i = 0; i < keys.length; i++) {
for (var i = 0; i < keys.length; i++) {
kv.add('${keys[i]}: ${values[i]}');
}
ast = new PureFunctionAST('{${kv.join(', ')}}', new MapFn(keys), values);
Expand Down Expand Up @@ -951,7 +951,7 @@ class _FilterWrapper extends FunctionApply {
argsWatches = new List(length);

apply(List values) {
for(var i=0; i < values.length; i++) {
for (var i=0; i < values.length; i++) {
var value = values[i];
var lastValue = args[i];
if (!identical(value, lastValue)) {
Expand Down
4 changes: 2 additions & 2 deletions lib/core_dom/block.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ class Block implements ElementWrapper {
bool preventDefault = false;

Function removeDomElements = () {
for(var j = 0, jj = elements.length; j < jj; j++) {
for (var j = 0; j < elements.length; j++) {
dom.Node current = elements[j];
dom.Node next = j+1 < jj ? elements[j+1] : null;
dom.Node next = j+1 < elements.length ? elements[j+1] : null;

while(next != null && current.nextNode != next) {
current.nextNode.remove();
Expand Down
6 changes: 3 additions & 3 deletions lib/core_dom/block_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class BlockFactory {
var preRenderedIndexOffset = 0;
var directiveDefsByName = {};

for (int i = 0, ii = directivePositions.length; i < ii;) {
for (int i = 0; i < directivePositions.length;) {
int index = directivePositions[i++];

List<DirectiveRef> directiveRefs = directivePositions[i++];
Expand Down Expand Up @@ -140,7 +140,7 @@ class BlockFactory {
nodeModule.factory(NgAttrMustacheDirective, (Injector injector) {
var scope = injector.get(Scope);
var interpolate = injector.get(Interpolate);
for(var ref in nodesAttrsDirectives) {
for (var ref in nodesAttrsDirectives) {
new NgAttrMustacheDirective(nodeAttrs, ref.value, interpolate,
scope, injector.get(AstParser), injector.get(FilterMap));
}
Expand Down Expand Up @@ -209,7 +209,7 @@ class BlockFactory {
}
}
}
for(var map in ref.mappings) {
for (var map in ref.mappings) {
var notify;
if (attachDelayStatus != null) {
var index = attachDelayStatus.length;
Expand Down
12 changes: 6 additions & 6 deletions lib/core_dom/compiler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Compiler {

cursorAlreadyAdvanced = false;

for (var j = 0, jj = declaredDirectiveRefs.length; j < jj; j++) {
for (var j = 0; j < declaredDirectiveRefs.length; j++) {
DirectiveRef directiveRef = declaredDirectiveRefs[j];
NgAnnotation annotation = directiveRef.annotation;
var blockFactory = null;
Expand All @@ -42,11 +42,11 @@ class Compiler {
domCursor, templateCursor,
directiveRef, remainingDirectives, directives);

j = jj; // stop processing further directives since they belong to transclusion;
}
if (usableDirectiveRefs == null) {
usableDirectiveRefs = [];
// stop processing further directives since they belong to
// transclusion
j = declaredDirectiveRefs.length;
}
if (usableDirectiveRefs == null) usableDirectiveRefs = [];
directiveRef.blockFactory = blockFactory;
createMappings(directiveRef);
usableDirectiveRefs.add(directiveRef);
Expand Down Expand Up @@ -178,7 +178,7 @@ class Compiler {
scope.watch(
dstExpression,
(outboundValue, _) {
if(!blockOutbound) {
if (!blockOutbound) {
blockInbound = true;
scope.rootScope.runAsync(() => blockInbound = false);
expressionFn.assign(scope.context, outboundValue);
Expand Down
4 changes: 2 additions & 2 deletions lib/core_dom/node_cursor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class NodeCursor {
cursorSize() => 1;

macroNext() {
for(var i = 0, ii = cursorSize(); i < ii; i++, index++){}
for (var i = 0, ii = cursorSize(); i < ii; i++, index++){}

return this.isValid();
}
Expand Down Expand Up @@ -75,7 +75,7 @@ class NodeCursor {
remove() {
var nodes = nodeList();

for (var i = 0, ii = nodes.length; i < ii; i++) {
for (var i = 0; i < nodes.length; i++) {
// NOTE(deboer): If elements is a list of child nodes on a node, then
// calling Node.remove() may also remove it from the list. Thus, we
// call elements.removeAt first so only one node is removed.
Expand Down
6 changes: 3 additions & 3 deletions lib/core_dom/selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ DirectiveSelector directiveSelectorFactory(DirectiveMap directives) {

// Select .name
if ((element.classes) != null) {
for(var name in element.classes) {
for (var name in element.classes) {
classes[name] = true;
partialSelection = elementSelector.selectClass(directiveRefs,
partialSelection, element, name);
Expand All @@ -299,7 +299,7 @@ DirectiveSelector directiveSelectorFactory(DirectiveMap directives) {
// Select [attributes]
element.attributes.forEach((attrName, value) {
attrs[attrName] = value;
for(var k = 0; k < attrSelector.length; k++) {
for (var k = 0; k < attrSelector.length; k++) {
_ContainsSelector selectorRegExp = attrSelector[k];
if (selectorRegExp.regexp.hasMatch(value)) {
// this directive is matched on any attribute name, and so
Expand Down Expand Up @@ -333,7 +333,7 @@ DirectiveSelector directiveSelectorFactory(DirectiveMap directives) {
break;
case 3: // Text Node
var value = node.nodeValue;
for(var k = 0; k < textSelector.length; k++) {
for (var k = 0; k < textSelector.length; k++) {
var selectorRegExp = textSelector[k];

if (selectorRegExp.regexp.hasMatch(value)) {
Expand Down
4 changes: 2 additions & 2 deletions lib/directive/input_select.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ class _SelectMode {

get _options => select.querySelectorAll('option');
_forEachOption(fn, [quiteOnReturn = false]) {
for(var os = _options, i = 0, ii = os.length; i < ii; i++) {
var retValue = fn(os[i], i);
for (var i = 0; i < _options.length; i++) {
var retValue = fn(_options[i], i);
if (quiteOnReturn && retValue != null) return retValue;
}
return null;
Expand Down
14 changes: 7 additions & 7 deletions lib/directive/ng_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class NgModel extends NgControl implements NgAttachAware {
BoundGetter getter = ([_]) => null;
BoundSetter setter = (_, [__]) => null;

var _lastValue;
var _lastValue;
String _exp;
final _validators = <NgValidatable>[];

Expand Down Expand Up @@ -206,7 +206,7 @@ class InputTextLikeDirective {
..onChange.listen(processValue)
..onInput.listen(processValue)
..onBlur.listen((e) {
if(ngModel.touched == null || ngModel.touched == false) {
if (ngModel.touched == null || ngModel.touched == false) {
ngModel.touched = true;
}
});
Expand All @@ -228,9 +228,9 @@ class InputTextLikeDirective {
* <input type="number|range" ng-model="myModel">
*
* Model:
*
*
* num myModel;
*
*
* This creates a two-way binding between the input and the named model property
* (e.g., myModel in the example above). When processing the input, its value is
* read as a [num], via the [dom.InputElement.valueAsNumber] field. If the input
Expand All @@ -248,21 +248,21 @@ class InputNumberLikeDirective {

num get typedValue => inputElement.valueAsNumber;
void set typedValue(num value) {
// [chalin, 2014-02-16] This post
// [chalin, 2014-02-16] This post
// http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-January/024829.html
// suggests that setting `valueAsNumber` to null should clear the field, but
// it does not. [TODO: put BUG/ISSUE number here]. We implement a
// workaround by setting `value`. Clean-up once the bug is fixed.
if (value == null) {
inputElement.value = null;
} else {
} else {
inputElement.valueAsNumber = value;
}
}

InputNumberLikeDirective(dom.Element this.inputElement, this.ngModel, this.scope) {
ngModel.render = (value) {
if (value != typedValue
if (value != typedValue
&& (value == null || value is num && !value.isNaN)) {
typedValue = value;
}
Expand Down
21 changes: 11 additions & 10 deletions lib/directive/ng_repeat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class NgRepeatDirective extends AbstractNgRepeatDirective {
* digest cycle and will not update on changes to the model.
*
*/
@deprecated
@NgDirective(
children: NgAnnotation.TRANSCLUDE_CHILDREN,
selector: '[ng-shallow-repeat]',
Expand All @@ -120,7 +121,7 @@ class NgShallowRepeatDirective extends AbstractNgRepeatDirective {
AstParser astParser)
: super(blockHole, boundBlockFactory, scope, parser, astParser)
{
print('DEPRICATED: [ng-shallow-repeat] use [ng-repeat]');
print('DEPRECATED: [ng-shallow-repeat] use [ng-repeat]');
}
}

Expand Down Expand Up @@ -218,7 +219,7 @@ abstract class AbstractNgRepeatDirective {
}
}
// remove existing items
_rows.forEach((key, row){
_rows.forEach((key, row) {
row.block.remove();
row.scope.destroy();
});
Expand All @@ -236,7 +237,7 @@ abstract class AbstractNgRepeatDirective {

List<_Row> newRowOrder = _computeNewRows(collection, trackById);

for (var index = 0, length = collection.length; index < length; index++) {
for (var index = 0; index < collection.length; index++) {
var value = collection.elementAt(index);
_Row row = newRowOrder[index];

Expand All @@ -263,14 +264,14 @@ abstract class AbstractNgRepeatDirective {
childContext[_valueIdentifier] = value;
}
var first = (index == 0);
var last = (index == (length - 1));
var last = (index == collection.length - 1);
childContext
..[r'$index'] = index
..[r'$first'] = (index == 0)
..[r'$last'] = (index == (length - 1))
..[r'$middle'] = !first && !last
..[r'$odd'] = index & 1 == 1
..[r'$even'] = index & 1 == 0;
..[r'$index'] = index
..[r'$first'] = first
..[r'$last'] = last
..[r'$middle'] = !first && !last
..[r'$odd'] = index & 1 == 1
..[r'$even'] = index & 1 == 0;

if (row.startNode == null) {
var block = _boundBlockFactory(childScope);
Expand Down
4 changes: 2 additions & 2 deletions lib/mock/test_bed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TestBed {
*/
Element compile(html, {Scope scope, DirectiveMap directives}) {
var injector = this.injector;
if(scope != null) {
if (scope != null) {
injector = injector.createChild([new Module()..value(Scope, scope)]);
}
if (html is String) {
Expand All @@ -63,7 +63,7 @@ class TestBed {
var div = new DivElement();
div.setInnerHtml(html, treeSanitizer: new NullTreeSanitizer());
var nodes = [];
for(var node in div.nodes) {
for (var node in div.nodes) {
nodes.add(node);
}
return nodes;
Expand Down
2 changes: 1 addition & 1 deletion test/_specs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Expect {
toEqualSelect(options) {
var actualOptions = [];

for(var option in actual.querySelectorAll('option')) {
for (var option in actual.querySelectorAll('option')) {
if (option.selected) {
actualOptions.add([option.value]);
} else {
Expand Down
Loading