Bug 767933 part 2. Implement codegen for 'unrestricted float' and 'unrestricted double', as aliases for float and double for now. r=khuey

This commit is contained in:
Boris Zbarsky 2012-11-27 15:32:05 -05:00
Родитель 866605e3b0
Коммит 4edad4b6bf
4 изменённых файлов: 110 добавлений и 2 удалений

Просмотреть файл

@ -1813,7 +1813,9 @@ builtinNames = {
IDLType.Tags.uint16: 'uint16_t',
IDLType.Tags.uint32: 'uint32_t',
IDLType.Tags.uint64: 'uint64_t',
IDLType.Tags.unrestricted_float: 'float',
IDLType.Tags.float: 'float',
IDLType.Tags.unrestricted_double: 'double',
IDLType.Tags.double: 'double'
}
@ -3291,8 +3293,9 @@ if (!%(resultStr)s) {
IDLType.Tags.uint16, IDLType.Tags.int32]:
return (setValue("INT_TO_JSVAL(int32_t(%s))" % result), True)
elif tag in [IDLType.Tags.int64, IDLType.Tags.uint64, IDLType.Tags.float,
IDLType.Tags.double]:
elif tag in [IDLType.Tags.int64, IDLType.Tags.uint64,
IDLType.Tags.unrestricted_float, IDLType.Tags.float,
IDLType.Tags.unrestricted_double, IDLType.Tags.double]:
# XXXbz will cast to double do the "even significand" thing that webidl
# calls for for 64-bit ints? Do we care?
return (setValue("JS_NumberValue(double(%s))" % result), True)

Просмотреть файл

@ -211,6 +211,43 @@ public:
void PassOptionalUnsignedLongLong(const Optional<uint64_t>&);
void PassOptionalUnsignedLongLongWithDefault(uint64_t);
float WritableFloat() const;
void SetWritableFloat(float);
float WritableUnrestrictedFloat() const;
void SetWritableUnrestrictedFloat(float);
Nullable<float> GetWritableNullableFloat() const;
void SetWritableNullableFloat(Nullable<float>);
Nullable<float> GetWritableNullableUnrestrictedFloat() const;
void SetWritableNullableUnrestrictedFloat(Nullable<float>);
double WritableDouble() const;
void SetWritableDouble(double);
double WritableUnrestrictedDouble() const;
void SetWritableUnrestrictedDouble(double);
Nullable<double> GetWritableNullableDouble() const;
void SetWritableNullableDouble(Nullable<double>);
Nullable<double> GetWritableNullableUnrestrictedDouble() const;
void SetWritableNullableUnrestrictedDouble(Nullable<double>);
void PassFloat(float, float, Nullable<float>, Nullable<float>,
double, double, Nullable<double>, Nullable<double>,
const Sequence<float>&, const Sequence<float>&,
const Sequence<Nullable<float> >&,
const Sequence<Nullable<float> >&,
const Sequence<double>&, const Sequence<double>&,
const Sequence<Nullable<double> >&,
const Sequence<Nullable<double> >&);
void PassLenientFloat(float, float, Nullable<float>, Nullable<float>,
double, double, Nullable<double>, Nullable<double>,
const Sequence<float>&, const Sequence<float>&,
const Sequence<Nullable<float> >&,
const Sequence<Nullable<float> >&,
const Sequence<double>&, const Sequence<double>&,
const Sequence<Nullable<double> >&,
const Sequence<Nullable<double> >&);
float LenientFloatAttr() const;
void SetLenientFloatAttr(float);
double LenientDoubleAttr() const;
void SetLenientDoubleAttr(double);
// Interface types
already_AddRefed<TestInterface> ReceiveSelf();
already_AddRefed<TestInterface> ReceiveNullableSelf();

Просмотреть файл

@ -150,6 +150,40 @@ interface TestInterface {
void passOptionalUnsignedLongLong(optional unsigned long long arg);
void passOptionalUnsignedLongLongWithDefault(optional unsigned long long arg = 17);
attribute float writableFloat;
attribute unrestricted float writableUnrestrictedFloat;
attribute float? writableNullableFloat;
attribute unrestricted float? writableNullableUnrestrictedFloat;
attribute double writableDouble;
attribute unrestricted double writableUnrestrictedDouble;
attribute double? writableNullableDouble;
attribute unrestricted double? writableNullableUnrestrictedDouble;
void passFloat(float arg1, unrestricted float arg2,
float? arg3, unrestricted float? arg4,
double arg5, unrestricted double arg6,
double? arg7, unrestricted double? arg8,
sequence<float> arg9, sequence<unrestricted float> arg10,
sequence<float?> arg11, sequence<unrestricted float?> arg12,
sequence<double> arg13, sequence<unrestricted double> arg14,
sequence<double?> arg15, sequence<unrestricted double?> arg16);
[LenientFloat]
void passLenientFloat(float arg1, unrestricted float arg2,
float? arg3, unrestricted float? arg4,
double arg5, unrestricted double arg6,
double? arg7, unrestricted double? arg8,
sequence<float> arg9,
sequence<unrestricted float> arg10,
sequence<float?> arg11,
sequence<unrestricted float?> arg12,
sequence<double> arg13,
sequence<unrestricted double> arg14,
sequence<double?> arg15,
sequence<unrestricted double?> arg16);
[LenientFloat]
attribute float lenientFloatAttr;
[LenientFloat]
attribute double lenientDoubleAttr;
// Castable interface types
// XXXbz add tests for throwing versions of all the castable interface stuff
TestInterface receiveSelf();

Просмотреть файл

@ -71,6 +71,40 @@ interface TestExampleInterface {
void passOptionalUnsignedLongLong(optional unsigned long long arg);
void passOptionalUnsignedLongLongWithDefault(optional unsigned long long arg = 17);
attribute float writableFloat;
attribute unrestricted float writableUnrestrictedFloat;
attribute float? writableNullableFloat;
attribute unrestricted float? writableNullableUnrestrictedFloat;
attribute double writableDouble;
attribute unrestricted double writableUnrestrictedDouble;
attribute double? writableNullableDouble;
attribute unrestricted double? writableNullableUnrestrictedDouble;
void passFloat(float arg1, unrestricted float arg2,
float? arg3, unrestricted float? arg4,
double arg5, unrestricted double arg6,
double? arg7, unrestricted double? arg8,
sequence<float> arg9, sequence<unrestricted float> arg10,
sequence<float?> arg11, sequence<unrestricted float?> arg12,
sequence<double> arg13, sequence<unrestricted double> arg14,
sequence<double?> arg15, sequence<unrestricted double?> arg16);
[LenientFloat]
void passLenientFloat(float arg1, unrestricted float arg2,
float? arg3, unrestricted float? arg4,
double arg5, unrestricted double arg6,
double? arg7, unrestricted double? arg8,
sequence<float> arg9,
sequence<unrestricted float> arg10,
sequence<float?> arg11,
sequence<unrestricted float?> arg12,
sequence<double> arg13,
sequence<unrestricted double> arg14,
sequence<double?> arg15,
sequence<unrestricted double?> arg16);
[LenientFloat]
attribute float lenientFloatAttr;
[LenientFloat]
attribute double lenientDoubleAttr;
// Castable interface types
// XXXbz add tests for throwing versions of all the castable interface stuff
TestInterface receiveSelf();