Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
NSNumber(OOJavaScriptConversion) Category Reference

Instance Methods

(jsval) - oo_jsValueInContext: [implementation]
 
(NSString *) - oo_jsClassName [implementation]
 

Detailed Description

Definition at line 1933 of file OOJavaScriptEngine.m.

Method Documentation

◆ oo_jsClassName

- (NSString *) oo_jsClassName
implementation

Definition at line 622 of file OOJavaScriptEngine.m.

1970{
1971 return @"Number";
1972}

◆ oo_jsValueInContext:

- (jsval) oo_jsValueInContext: (JSContext *) context
implementation

Definition at line 622 of file OOJavaScriptEngine.m.

1935 :(JSContext *)context
1936{
1938
1939 jsval result;
1940 BOOL isFloat = NO;
1941 long long longLongValue;
1942
1943 isFloat = [self oo_isFloatingPointNumber];
1944 if (!isFloat)
1945 {
1946 longLongValue = [self longLongValue];
1947 if (longLongValue < (long long)JSVAL_INT_MIN || (long long)JSVAL_INT_MAX < longLongValue)
1948 {
1949 // values outside JSVAL_INT range are returned as doubles.
1950 isFloat = YES;
1951 }
1952 }
1953
1954 if (isFloat)
1955 {
1956 if (!JS_NewNumberValue(context, [self doubleValue], &result)) result = JSVAL_VOID;
1957 }
1958 else
1959 {
1960 result = INT_TO_JSVAL((int32_t)longLongValue);
1961 }
1962
1963 return result;
1964
1966}
#define OOJS_PROFILE_ENTER
#define OOJS_PROFILE_EXIT_JSVAL

The documentation for this category was generated from the following file: