Before

…lines 1–54 unchanged (54 lines)
55 var loggerP: ICELoggerProtocol?
56 if let logger = initData.logger {
57 loggerP = LoggerWrapper(handle: logger)
58 }
59
60 let propsHandle = (newInitData.properties as! PropertiesI).handle
61
62 return try autoreleasepool {
63 let handle = try ICEUtil.initialize(propsHandle, logger: loggerP)
64
65 precondition(propsHandle === handle.getProperties(), "initialize changed the properties object")
66
67 // Update newInitData.logger reference in case we are using a C++ logger (defined though a property) or
…lines 68–208 unchanged (141 lines)

After

…lines 1–55 unchanged (55 lines)
56 if let logger = initData.logger {
57 loggerP = LoggerWrapper(handle: logger)
58 }
59
60 let propsHandle = (newInitData.properties as! PropertiesI).handle
61
62 let properties = newInitData.properties!
63
64 // If the user has not set Ice.ProgramName, set it to the Swift executable name.
65 if properties.getIceProperty("Ice.ProgramName").isEmpty {
66 if let programName = CommandLine.arguments.first.map({ URL(fileURLWithPath: $0).lastPathComponent }) {
67 properties.setProperty(key: "Ice.ProgramName", value: programName)
68 } else {
69 properties.setProperty(key: "Ice.ProgramName", value: "IceSwift")
70 }
71 }
72
73 return try autoreleasepool {
74 let handle = try ICEUtil.initialize(propsHandle, logger: loggerP)
75
76 precondition(propsHandle === handle.getProperties(), "initialize changed the properties object")
77
…lines 78–219 unchanged (142 lines)

Before

source_file
comment "// Copyright (c) ZeroC, Inc."
import_declaration
import "import"
identifier
simple_identifier "IceImpl"
comment "//"
comment "// Factories are registered once when `factoriesRegistered' "...
comment "// all Swift global variables are lazy initialized."
comment "//"
comment "// All code paths that require the use of the factories befo"...
comment "// should check `factoriesRegistered' to ensure lazy initial"...
comment "// the factories are used."
comment "//"
property_declaration (+72 nodes collapsed)
comment "/// Creates a new communicator, using Ice properties parsed "...
comment "/// - Parameter args: The command-line arguments. This funct"...
comment "/// reserved prefixes (Ice, IceSSL, etc.) as properties fo"...
comment "/// with `--Ice.Config`, this function loads the specified"...
comment "/// configuration file and through a command-line argument"...
comment "/// - Returns: The new communicator."
function_declaration (+53 nodes collapsed)
comment "/// Creates a new communicator, using Ice properties parsed "...
comment "/// - Parameter args: The command-line arguments. This funct"...
comment "/// reserved prefixes (Ice, IceSSL, etc.) as properties fo"...
comment "/// with `--Ice.Config`, this function loads the specified"...
comment "/// configuration file and through a command-line argument"...
comment "/// modifies args by removing any Ice-related options."
comment "/// - Returns: The new communicator."
function_declaration (+58 nodes collapsed)
comment "/// Creates a new communicator."
comment "/// - Parameter initData: Options for the new communicator."
comment "/// - Returns: The new communicator."
function_declaration
modifiers
visibility_modifier
public "public"
func "func"
simple_identifier "initialize"
( "("
parameter
simple_identifier "_"
simple_identifier "initData"
: ":"
user_type
type_identifier "InitializationData"
= "="
call_expression
simple_identifier "InitializationData"
call_suffix
value_arguments
( "("
) ")"
) ")"
throws "throws"
-> "->"
user_type
type_identifier "Communicator"
function_body
{ "{"
comment "// Ensure factories are initialized."
statements
guard_statement
guard "guard"
simple_identifier "factoriesRegistered"
else "else"
{ "{"
statements
call_expression
simple_identifier "fatalError"
call_suffix
value_arguments
( "("
value_argument
line_string_literal
" "\""
line_str_text "Unable to initialize Ice"
" "\""
) ")"
} "}"
property_declaration
value_binding_pattern
var "var"
pattern
simple_identifier "newInitData"
= "="
simple_identifier "initData"
assignment (+21 nodes collapsed)
property_declaration
value_binding_pattern
var "var"
pattern
simple_identifier "loggerP"
type_annotation
: ":"
optional_type
user_type
type_identifier "ICELoggerProtocol"
?
? "?"
if_statement (+29 nodes collapsed)
property_declaration (+23 nodes collapsed)
control_transfer_statement (+335 nodes collapsed)
} "}"
comment "/// Creates a new empty property set."
comment "///"
comment "/// - Returns: A new empty property set."
function_declaration (+55 nodes collapsed)
comment "/// Creates a property set initialized from an argument arra"...
comment "///"
comment "/// - Parameters:"
comment "/// - args: A command-line argument array, possibly contai"...
comment "/// command-line options include `--Ice.Config`, the cor"...
comment "/// property is set in a configuration file and in the a"...
comment "/// - defaults: Optional default values for the property s"...
comment "/// argument array override these defaults."
comment "/// - Returns: A new property set initialized with the prope"...
function_declaration (+126 nodes collapsed)
comment "/// Creates a property set initialized from an argument arra"...
comment "///"
comment "/// - Parameters:"
comment "/// - args: A command-line argument array, possibly contai"...
comment "/// command-line options include `--Ice.Config`, the cor"...
comment "/// property is set in a configuration file and in the a"...
comment "/// method modifies the argument array by removing any I"...
comment "/// - defaults: Optional default values for the property s"...
comment "/// argument array override these defaults."
comment "/// - Returns: A new property set initialized with the prope"...
function_declaration (+158 nodes collapsed)
comment "/// Returns the Ice version as an integer in the form AABBCC"...
comment "/// indicates the major version, BB indicates the minor vers"...
comment "/// indicates the patch level. For example, for Ice 3.8.1, t"...
comment "/// value is 30801."
property_declaration
modifiers
visibility_modifier
public "public"
value_binding_pattern
let "let"
pattern
simple_identifier "intVersion"
type_annotation
: ":"
user_type
type_identifier "Int"
= "="
integer_literal "30850"
comment "/// The Ice version in the form A.B.C, where A indicates the"...
comment "/// B indicates the minor version, and C indicates the patch"...
property_declaration
modifiers
visibility_modifier
public "public"
value_binding_pattern
let "let"
pattern
simple_identifier "stringVersion"
type_annotation
: ":"
user_type
type_identifier "String"
= "="
line_string_literal
" "\""
line_str_text "3.8.0-alpha.0"
" "\""
property_declaration (+26 nodes collapsed)
property_declaration (+26 nodes collapsed)
property_declaration
modifiers
visibility_modifier
public "public"
value_binding_pattern
let "let"
pattern
simple_identifier "currentEncoding"
= "="
simple_identifier "Encoding_1_1"
comment "/// Converts a string to an object identity."
comment "///"
comment "/// - Parameter string: The string to convert."
comment "/// - Returns: The converted object identity."
function_declaration (+139 nodes collapsed)
comment "/// Converts an object identity to a string."
comment "///"
comment "/// - Parameters:"
comment "/// - id: The object identity to convert."
comment "/// - mode: Specifies if and how non-printable ASCII chara"...
comment "/// - Returns: The string representation of the object ident"...
function_declaration (+95 nodes collapsed)
comment "/// Converts an encoding version to a string."
comment "///"
comment "/// - Parameter encoding: The encoding version to convert."
comment "/// - Returns: The converted string."
function_declaration (+52 nodes collapsed)

After

source_file
comment "// Copyright (c) ZeroC, Inc."
import_declaration
import "import"
identifier
simple_identifier "IceImpl"
comment "//"
comment "// Factories are registered once when `factoriesRegistered' "...
comment "// all Swift global variables are lazy initialized."
comment "//"
comment "// All code paths that require the use of the factories befo"...
comment "// should check `factoriesRegistered' to ensure lazy initial"...
comment "// the factories are used."
comment "//"
property_declaration (+72 nodes collapsed)
comment "/// Creates a new communicator, using Ice properties parsed "...
comment "/// - Parameter args: The command-line arguments. This funct"...
comment "/// reserved prefixes (Ice, IceSSL, etc.) as properties fo"...
comment "/// with `--Ice.Config`, this function loads the specified"...
comment "/// configuration file and through a command-line argument"...
comment "/// - Returns: The new communicator."
function_declaration (+53 nodes collapsed)
comment "/// Creates a new communicator, using Ice properties parsed "...
comment "/// - Parameter args: The command-line arguments. This funct"...
comment "/// reserved prefixes (Ice, IceSSL, etc.) as properties fo"...
comment "/// with `--Ice.Config`, this function loads the specified"...
comment "/// configuration file and through a command-line argument"...
comment "/// modifies args by removing any Ice-related options."
comment "/// - Returns: The new communicator."
function_declaration (+58 nodes collapsed)
comment "/// Creates a new communicator."
comment "/// - Parameter initData: Options for the new communicator."
comment "/// - Returns: The new communicator."
function_declaration
modifiers
visibility_modifier
public "public"
func "func"
simple_identifier "initialize"
( "("
parameter
simple_identifier "_"
simple_identifier "initData"
: ":"
user_type
type_identifier "InitializationData"
= "="
call_expression
simple_identifier "InitializationData"
call_suffix
value_arguments
( "("
) ")"
) ")"
throws "throws"
-> "->"
user_type
type_identifier "Communicator"
function_body
{ "{"
comment "// Ensure factories are initialized."
statements
guard_statement
guard "guard"
simple_identifier "factoriesRegistered"
else "else"
{ "{"
statements
call_expression
simple_identifier "fatalError"
call_suffix
value_arguments
( "("
value_argument
line_string_literal
" "\""
line_str_text "Unable to initialize Ice"
" "\""
) ")"
} "}"
property_declaration
value_binding_pattern
var "var"
pattern
simple_identifier "newInitData"
= "="
simple_identifier "initData"
assignment (+21 nodes collapsed)
property_declaration
value_binding_pattern
var "var"
pattern
simple_identifier "loggerP"
type_annotation
: ":"
optional_type
user_type
type_identifier "ICELoggerProtocol"
?
? "?"
if_statement (+29 nodes collapsed)
property_declaration (+23 nodes collapsed)
property_declaration
value_binding_pattern
let "let"
pattern
simple_identifier "properties"
= "="
postfix_expression
navigation_expression
simple_identifier "newInitData"
navigation_suffix
. "."
simple_identifier "properties"
bang "!"
comment "// If the user has not set Ice.ProgramName, set it to the Sw"...
if_statement
if "if"
navigation_expression
call_expression
navigation_expression
simple_identifier "properties"
navigation_suffix
. "."
simple_identifier "getIceProperty"
call_suffix
value_arguments
( "("
value_argument
line_string_literal
" "\""
line_str_text "Ice.ProgramName"
" "\""
) ")"
navigation_suffix
. "."
simple_identifier "isEmpty"
{ "{"
statements
if_statement
if "if"
value_binding_pattern
let "let"
simple_identifier "programName"
= "="
call_expression
navigation_expression
navigation_expression
navigation_expression
simple_identifier "CommandLine"
navigation_suffix
. "."
simple_identifier "arguments"
navigation_suffix
. "."
simple_identifier "first"
navigation_suffix
. "."
simple_identifier "map"
call_suffix
value_arguments
( "("
value_argument
lambda_literal
{ "{"
statements
navigation_expression
call_expression
simple_identifier "URL"
call_suffix
value_arguments
( "("
value_argument
value_argument_label
simple_identifier "fileURLWithPath"
: ":"
simple_identifier "$0"
) ")"
navigation_suffix
. "."
simple_identifier "lastPathComponent"
} "}"
) ")"
{ "{"
statements
call_expression
navigation_expression
simple_identifier "properties"
navigation_suffix
. "."
simple_identifier "setProperty"
call_suffix
value_arguments
( "("
value_argument
value_argument_label
simple_identifier "key"
: ":"
line_string_literal
" "\""
line_str_text "Ice.ProgramName"
" "\""
, ","
value_argument
value_argument_label
simple_identifier "value"
: ":"
simple_identifier "programName"
) ")"
} "}"
else "else"
{ "{"
statements
call_expression
navigation_expression
simple_identifier "properties"
navigation_suffix
. "."
simple_identifier "setProperty"
call_suffix
value_arguments
( "("
value_argument
value_argument_label
simple_identifier "key"
: ":"
line_string_literal
" "\""
line_str_text "Ice.ProgramName"
" "\""
, ","
value_argument
value_argument_label
simple_identifier "value"
: ":"
line_string_literal
" "\""
line_str_text "IceSwift"
" "\""
) ")"
} "}"
} "}"
control_transfer_statement (+335 nodes collapsed)
} "}"
comment "/// Creates a new empty property set."
comment "///"
comment "/// - Returns: A new empty property set."
function_declaration (+55 nodes collapsed)
comment "/// Creates a property set initialized from an argument arra"...
comment "///"
comment "/// - Parameters:"
comment "/// - args: A command-line argument array, possibly contai"...
comment "/// command-line options include `--Ice.Config`, the cor"...
comment "/// property is set in a configuration file and in the a"...
comment "/// - defaults: Optional default values for the property s"...
comment "/// argument array override these defaults."
comment "/// - Returns: A new property set initialized with the prope"...
function_declaration (+126 nodes collapsed)
comment "/// Creates a property set initialized from an argument arra"...
comment "///"
comment "/// - Parameters:"
comment "/// - args: A command-line argument array, possibly contai"...
comment "/// command-line options include `--Ice.Config`, the cor"...
comment "/// property is set in a configuration file and in the a"...
comment "/// method modifies the argument array by removing any I"...
comment "/// - defaults: Optional default values for the property s"...
comment "/// argument array override these defaults."
comment "/// - Returns: A new property set initialized with the prope"...
function_declaration (+158 nodes collapsed)
comment "/// Returns the Ice version as an integer in the form AABBCC"...
comment "/// indicates the major version, BB indicates the minor vers"...
comment "/// indicates the patch level. For example, for Ice 3.8.1, t"...
comment "/// value is 30801."
property_declaration
modifiers
visibility_modifier
public "public"
value_binding_pattern
let "let"
pattern
simple_identifier "intVersion"
type_annotation
: ":"
user_type
type_identifier "Int"
= "="
integer_literal "30850"
comment "/// The Ice version in the form A.B.C, where A indicates the"...
comment "/// B indicates the minor version, and C indicates the patch"...
property_declaration
modifiers
visibility_modifier
public "public"
value_binding_pattern
let "let"
pattern
simple_identifier "stringVersion"
type_annotation
: ":"
user_type
type_identifier "String"
= "="
line_string_literal
" "\""
line_str_text "3.8.0-alpha.0"
" "\""
property_declaration (+26 nodes collapsed)
property_declaration (+26 nodes collapsed)
property_declaration
modifiers
visibility_modifier
public "public"
value_binding_pattern
let "let"
pattern
simple_identifier "currentEncoding"
= "="
simple_identifier "Encoding_1_1"
comment "/// Converts a string to an object identity."
comment "///"
comment "/// - Parameter string: The string to convert."
comment "/// - Returns: The converted object identity."
function_declaration (+139 nodes collapsed)
comment "/// Converts an object identity to a string."
comment "///"
comment "/// - Parameters:"
comment "/// - id: The object identity to convert."
comment "/// - mode: Specifies if and how non-printable ASCII chara"...
comment "/// - Returns: The string representation of the object ident"...
function_declaration (+95 nodes collapsed)
comment "/// Converts an encoding version to a string."
comment "///"
comment "/// - Parameter encoding: The encoding version to convert."
comment "/// - Returns: The converted string."
function_declaration (+52 nodes collapsed)