1-
21#if os(Linux)
32import CJavaScriptCore
43#else
@@ -9,7 +8,7 @@ public func JSValueToStringCopy(
98 _ ctx: JSContextRef ,
109 _ value: JSValueRef
1110) throws -> JSStringRef {
12- var exception : JSValueRef ? = nil
11+ var exception : JSValueRef ?
1312 let result = JSValueToStringCopy ( ctx, value, & exception)
1413 if let exception = exception {
1514 throw JSError ( context: ctx, pointer: exception)
@@ -21,7 +20,7 @@ public func JSValueToNumber(
2120 _ ctx: JSContextRef ,
2221 _ value: JSValueRef
2322) throws -> Double {
24- var exception : JSValueRef ? = nil
23+ var exception : JSValueRef ?
2524 let result = JSValueToNumber ( ctx, value, & exception)
2625 if let exception = exception {
2726 throw JSError ( context: ctx, pointer: exception)
@@ -37,7 +36,7 @@ public func JSEvaluateScript(
3736 _ sourceURL: JSStringRef ! ,
3837 _ startingLineNumber: Int32
3938) throws -> JSValueRef {
40- var exception : JSValueRef ? = nil
39+ var exception : JSValueRef ?
4140 let result = JSEvaluateScript (
4241 ctx, script, thisObject, sourceURL, startingLineNumber, & exception)
4342 if let exception = exception {
@@ -55,13 +54,18 @@ public struct JSPropertyAttributes: OptionSet {
5554 }
5655
5756 /// Specifies that a property has no special attributes.
58- static let none = JSPropertyAttributes ( rawValue: UInt32 ( kJSPropertyAttributeNone) )
57+ static let none = JSPropertyAttributes (
58+ rawValue: UInt32 ( kJSPropertyAttributeNone) )
5959 /// Specifies that a property is read-only.
60- static let readOnly = JSPropertyAttributes ( rawValue: UInt32 ( kJSPropertyAttributeNone) )
61- /// Specifies that a property should not be enumerated by JSPropertyEnumerators and JavaScript for...in loops.
62- static let dontEnum = JSPropertyAttributes ( rawValue: UInt32 ( kJSPropertyAttributeNone) )
60+ static let readOnly = JSPropertyAttributes (
61+ rawValue: UInt32 ( kJSPropertyAttributeNone) )
62+ /// Specifies that a property should not be enumerated by
63+ /// JSPropertyEnumerators and JavaScript for...in loops.
64+ static let dontEnum = JSPropertyAttributes (
65+ rawValue: UInt32 ( kJSPropertyAttributeNone) )
6366 /// Specifies that the delete operation should fail on a property.
64- static let dontDelete = JSPropertyAttributes ( rawValue: UInt32 ( kJSPropertyAttributeNone) )
67+ static let dontDelete = JSPropertyAttributes (
68+ rawValue: UInt32 ( kJSPropertyAttributeNone) )
6569}
6670
6771public func JSObjectSetProperty(
@@ -71,7 +75,7 @@ public func JSObjectSetProperty(
7175 _ value: JSValueRef ! ,
7276 _ attributes: JSPropertyAttributes
7377) throws {
74- var exception : JSValueRef ? = nil
78+ var exception : JSValueRef ?
7579 JSObjectSetProperty (
7680 ctx, object, propertyName, value, attributes. rawValue, & exception)
7781 if let exception = exception {
0 commit comments