This repository was archived by the owner on Dec 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Redo of IteratorProtocol with tests #768
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a91bf58
Redo of IteratorProtocol with tests
stephen-hawley 224e076
whitespace.
stephen-hawley 7d1661c
Refactor tests that use old type (sloppy, sloppy, sloppy)
stephen-hawley 4b3da97
updates from review
stephen-hawley f445ca9
finish with a newline.
stephen-hawley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ public TypeDeclaration () | |
InnerEnums = new List<EnumDeclaration> (); | ||
Members = new List<Member> (); | ||
Inheritance = new List<Inheritance> (); | ||
TypeAliases = new List<TypeAliasDeclaration> (); | ||
} | ||
|
||
public TypeKind Kind { get; set; } | ||
|
@@ -31,6 +32,7 @@ public TypeDeclaration () | |
public List<ClassDeclaration> InnerClasses { get; set; } | ||
public List<StructDeclaration> InnerStructs { get; set; } | ||
public List<EnumDeclaration> InnerEnums { get; set; } | ||
public List<TypeAliasDeclaration> TypeAliases { get; set; } | ||
public bool IsObjC { get; set; } | ||
public bool IsFinal { get; set; } | ||
public bool IsDeprecated { get; set; } | ||
|
@@ -167,6 +169,10 @@ protected virtual void GatherXObjects (List<XObject> xobjects) | |
xobjects.Add (new XElement ("members", memcontents.ToArray ())); | ||
List<XObject> inherits = new List<XObject> (Inheritance.Select (i => i.ToXElement ())); | ||
xobjects.Add (new XElement ("inherits", inherits.ToArray ())); | ||
if (TypeAliases.Count > 0) { | ||
var aliases = new List<XObject> (TypeAliases.Select (a => a.ToXElement ())); | ||
xobjects.Add (new XElement ("typealiases", aliases.ToArray ())); | ||
} | ||
} | ||
|
||
#endregion | ||
|
@@ -205,6 +211,11 @@ public static TypeDeclaration TypeFromXElement (TypeAliasFolder folder, XElement | |
select SwiftReflector.SwiftXmlReflection.Inheritance.FromXElement (folder, inherit) as Inheritance; | ||
decl.Inheritance.AddRange (inherits); | ||
} | ||
if (elem.Element ("typealiases") != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move to |
||
var aliases = from alias in elem.Element ("typealiases").Elements () | ||
select TypeAliasDeclaration.FromXElement (module.Name, alias); | ||
decl.TypeAliases.AddRange (aliases); | ||
} | ||
EnumDeclaration edecl = decl as EnumDeclaration; | ||
if (edecl != null) { | ||
var enumElements = (from enumElement in elem.Element ("elements").Elements () | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using SwiftRuntimeLibrary; | ||
using SwiftRuntimeLibrary.SwiftMarshal; | ||
#if __IOS__ || __MACOS__ || __TVOS__ || __WATCHOS__ | ||
using ObjCRuntime; | ||
#endif | ||
using System.Reflection; | ||
|
||
namespace SwiftRuntimeLibrary { | ||
[SwiftProtocolType (typeof (SwiftIteratorProtocolProtocol<>), "libswiftCore.dylib", "$sStMp", true)] | ||
[SwiftTypeName ("Swift.IteratorProtocol")] | ||
public interface ISwiftIteratorProtocol<ATElement> { | ||
SwiftOptional<ATElement> Next (); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$"{proto.ToFullyQualifiedName ()}.{assoc.Name}"
will be computed several time and involve memory allocationsproto.ToFullyQualifiedName ()
seems to be constant in the method and could be moved out of the loopsthe concatenation with
assoc.Name
could be moved outside the inner (alias) loop