Skip to content

Commit

Permalink
Address first comments
Browse files Browse the repository at this point in the history
  • Loading branch information
maicki committed Jul 9, 2018
1 parent af2e176 commit 9f10598
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Source/ASTextNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ - (NSAttributedString *)_locked_prepareTruncationStringForDrawing:(NSAttributedS
NSDictionary *originalStringAttributes = [originalString attributesAtIndex:originalStringLength-1 effectiveRange:NULL];
[truncationString enumerateAttributesInRange:NSMakeRange(0, truncationString.length) options:0 usingBlock:
^(NSDictionary *attributes, NSRange range, BOOL *stop) {
NSMutableDictionary *futureTruncationAttributes = [[NSMutableDictionary alloc] initWithDictionary:originalStringAttributes];
NSMutableDictionary *futureTruncationAttributes = [originalStringAttributes mutableCopy];
[futureTruncationAttributes addEntriesFromDictionary:attributes];
[truncationMutableString setAttributes:futureTruncationAttributes range:range];
}];
Expand Down
2 changes: 1 addition & 1 deletion Source/ASTextNode2.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ - (NSAttributedString *)_locked_prepareTruncationStringForDrawing:(NSAttributedS
NSDictionary *originalStringAttributes = [originalString attributesAtIndex:originalStringLength-1 effectiveRange:NULL];
[truncationString enumerateAttributesInRange:NSMakeRange(0, truncationString.length) options:0 usingBlock:
^(NSDictionary *attributes, NSRange range, BOOL *stop) {
NSMutableDictionary *futureTruncationAttributes = [[NSMutableDictionary alloc] initWithDictionary:originalStringAttributes];
NSMutableDictionary *futureTruncationAttributes = [originalStringAttributes mutableCopy];
[futureTruncationAttributes addEntriesFromDictionary:attributes];
[truncationMutableString setAttributes:futureTruncationAttributes range:range];
}];
Expand Down
9 changes: 5 additions & 4 deletions Source/Details/ASIntegerMap.mm
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ - (ASIntegerMap *)inverseMap
}

let result = [[ASIntegerMap alloc] init];
for (var it = _map.begin(); it != _map.end(); it++) {
result->_map[it->second] = it->first;

for (let &e : _map) {
result->_map[e.second] = e.first;
}
return result;
}
Expand Down Expand Up @@ -155,8 +156,8 @@ - (id)copyWithZone:(NSZone *)zone
} else {
// { 1->2 3->4 5->6 }
NSMutableString *str = [NSMutableString string];
for (var it = _map.begin(); it != _map.end(); it++) {
[str appendFormat:@" %zd->%zd", it->first, it->second];
for (let &e : _map) {
[str appendFormat:@" %zd->%zd", e.first, e.second];
}
// Remove leading space
if (str.length > 0) {
Expand Down
4 changes: 2 additions & 2 deletions Source/Private/ASRectMap.mm
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ - (id)copyWithZone:(NSZone *)zone

// { ptr1->rect1 ptr2->rect2 ptr3->rect3 }
NSMutableString *str = [NSMutableString string];
for (var it = _map.begin(); it != _map.end(); it++) {
[str appendFormat:@" %@->%@", it->first, NSStringFromCGRect(it->second)];
for (let &e : _map) {
[str appendFormat:@" %@->%@", e.first, NSStringFromCGRect(e.second)];
}
[result addObject:@{ @"ASRectMap": str }];

Expand Down
4 changes: 2 additions & 2 deletions Source/Private/_ASHierarchyChangeSet.mm
Original file line number Diff line number Diff line change
Expand Up @@ -918,10 +918,10 @@ + (void)sortAndCoalesceItemChanges:(NSMutableArray<_ASHierarchyItemChange *> *)c
ASDisplayNodeAssert(ASHierarchyChangeTypeIsFinal(type), @"Attempt to sort and coalesce item changes of intermediary type %@. Why?", NSStringFromASHierarchyChangeType(type));

// Lookup table [NSIndexPath: AnimationOptions]
NSMutableDictionary *animationOptions = [[NSMutableDictionary alloc] init];
let animationOptions = [[NSMutableDictionary<NSIndexPath *, NSNumber *> alloc] init];

// All changed index paths, sorted
NSMutableArray *allIndexPaths = [[NSMutableArray alloc] init];
let allIndexPaths = [[NSMutableArray<NSIndexPath *> alloc] init];

for (_ASHierarchyItemChange *change in changes) {
for (NSIndexPath *indexPath in change.indexPaths) {
Expand Down
13 changes: 11 additions & 2 deletions Tests/ASPerformanceTestContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
// ASPerformanceTestContext.m
// Texture
//
// Created by Adlai Holler on 8/28/16.
// Copyright © 2016 Facebook. All rights reserved.
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional
// grant of patent rights can be found in the PATENTS file in the same directory.
//
// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present,
// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//

#import <Foundation/Foundation.h>
Expand Down

0 comments on commit 9f10598

Please sign in to comment.