-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1574 from hylo-lang/fix-mangling
Fix the mangling algorithm
- Loading branch information
Showing
18 changed files
with
804 additions
and
574 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[default.extend-words] | ||
inout = "inout" # Mutable projection keyword | ||
olt = "olt" # Abbreviation for "ordered less than" | ||
|
||
[files] | ||
extend-exclude = ["Tests/ManglingTests/MangledStrings.swift"] |
This file contains 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 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 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 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 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 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 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 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,41 @@ | ||
/// The demangled qualification of a symbol. | ||
public indirect enum DemangledQualification: Hashable { | ||
|
||
/// An entity. | ||
case entity(DemangledEntity) | ||
|
||
/// A reference to the innermost enclosing entity. | ||
case relative | ||
|
||
/// Creates an instance wrapping `e` iff it is not `nil`. | ||
init?(_ e: DemangledEntity?) { | ||
if let s = e { | ||
self = .entity(s) | ||
} else { | ||
return nil | ||
} | ||
} | ||
|
||
/// The entity wrapped in `self` if its payload is `.entity`, or `nil` otherwise. | ||
public var entity: DemangledEntity? { | ||
if case .entity(let e) = self { | ||
return e | ||
} else { | ||
return nil | ||
} | ||
} | ||
|
||
} | ||
|
||
extension DemangledQualification: CustomStringConvertible { | ||
|
||
public var description: String { | ||
switch self { | ||
case .entity(let d): | ||
return d.description | ||
case .relative: | ||
return ".." | ||
} | ||
} | ||
|
||
} |
This file contains 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 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,49 @@ | ||
import Utils | ||
|
||
/// The demangled description of a synthesized function. | ||
public struct DemangledSynthesizedFunction: Hashable { | ||
|
||
/// The kind of a synthesized declaration. | ||
public indirect enum Kind: Hashable { | ||
|
||
/// A deinitializer. | ||
case deinitialize | ||
|
||
/// A move-initialization method. | ||
case moveInitialization | ||
|
||
/// A move-assignment method. | ||
case moveAssignment | ||
|
||
/// A copy method. | ||
case copy | ||
|
||
/// An equality method. | ||
case equal | ||
|
||
/// A global initializer for a binding declaration. | ||
case globalInitialization(DemangledSymbol) | ||
|
||
/// Lambda generated for an autoclosure argument. | ||
case autoclosure(Int) | ||
|
||
} | ||
|
||
/// The type of this declaration. | ||
public let type: DemangledType | ||
|
||
/// The scope in which the declaration is defined. | ||
public let scope: Indirect<DemangledSymbol> | ||
|
||
/// The kind of the declaration. | ||
public let kind: Kind | ||
|
||
} | ||
|
||
extension DemangledSynthesizedFunction: CustomStringConvertible { | ||
|
||
public var description: String { | ||
"\(scope).\(kind)" | ||
} | ||
|
||
} |
This file contains 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
Oops, something went wrong.