1.1 --- a/src/Types.cpp Mon Dec 24 02:56:02 2012 -0800
1.2 +++ b/src/Types.cpp Mon Dec 24 16:09:13 2012 -0800
1.3 @@ -135,86 +135,6 @@
1.4 return type;
1.5 }
1.6
1.7 -#if 0
1.8 -Type *
1.9 -Type::NewNative(Zone *zone, Handle<Type> returnType, Handle<FixedArray> parameters,
1.10 - Handle<FixedArray> defaults, bool variadic)
1.11 -{
1.12 - Local<Type> type(zone, Type::cast(zone->allocate(MapKind_Type, sizeof(Type), Heap::Tenure_Old)));
1.13 - if (!type)
1.14 - return NULL;
1.15 -
1.16 - type->kind_ = NATIVE;
1.17 - type->contained_ = NULL;
1.18 - type->fields_ = NULL;
1.19 - type->newMap_ = NULL;
1.20 - type->returnType_ = returnType;
1.21 - type->parameters_ = parameters;
1.22 - type->defaults_ = defaults;
1.23 - type->variadicNative_ = variadic;
1.24 - return type;
1.25 -}
1.26 -#endif
1.27 -
1.28 -bool
1.29 -Type::Compare(Type *left, Type *right)
1.30 -{
1.31 - if (left == right)
1.32 - return true;
1.33 -
1.34 - if (left->kind() != right->kind())
1.35 - return false;
1.36 -
1.37 - switch (left->kind()) {
1.38 - case Type::PRIMITIVE:
1.39 - return left->primitive() == right->primitive();
1.40 -
1.41 - case Type::ARRAY:
1.42 - {
1.43 - ArrayType *aleft = ArrayType::cast(left);
1.44 - ArrayType *aright = ArrayType::cast(right);
1.45 - if (aleft->levels() != aright->levels())
1.46 - return false;
1.47 - if (aleft->isFixedLength() != aright->isFixedLength())
1.48 - return false;
1.49 - if (aleft->isFixedLength() && aleft->fixedLength() != aright->fixedLength())
1.50 - return false;
1.51 - return Compare(aleft->contained(), aright->contained());
1.52 - }
1.53 -
1.54 - case Type::FUNCTION:
1.55 - {
1.56 - FunctionType *fleft = FunctionType::cast(left);
1.57 - FunctionType *fright = FunctionType::cast(right);
1.58 - if (!Compare(fleft->returnType(), fright->returnType()))
1.59 - return false;
1.60 - if (fleft->parameters()->length() != fright->parameters()->length())
1.61 - return false;
1.62 - if (fleft->isNative() != fright->isNative())
1.63 - return false;
1.64 - if (fleft->isNative() && (fleft->isNativeVariadic() != fright->isNativeVariadic()))
1.65 - return false;
1.66 - for (unsigned i = 0; i < fleft->parameters()->length(); i++) {
1.67 - Type *leftparam = fleft->parameterAt(i);
1.68 - Type *rightparam = fright->parameterAt(i);
1.69 - if (!Compare(leftparam, rightparam))
1.70 - return false;
1.71 - }
1.72 - return true;
1.73 - }
1.74 -
1.75 - case Type::ENUM:
1.76 - return false;
1.77 -
1.78 - case Type::VOID:
1.79 - return true;
1.80 -
1.81 - default:
1.82 - assert(left->kind() == Type::REFERENCE);
1.83 - return Compare(ReferenceType::cast(left)->contained(), ReferenceType::cast(right)->contained());
1.84 - }
1.85 -}
1.86 -
1.87 StructType *
1.88 StructType::New(Zone *zone, Handle<String> name, Handle<FixedArray> fields)
1.89 {