bool AsmJsFunctionDeclaration::CheckAndSetReturnType(Js::AsmJsRetType val) { Assert((val != AsmJsRetType::Fixnum && val != AsmJsRetType::Unsigned && val != AsmJsRetType::Floatish) || GetSymbolType() == AsmJsSymbol::MathBuiltinFunction); if (mReturnTypeKnown) { Assert((mReturnType != AsmJsRetType::Fixnum && mReturnType != AsmJsRetType::Unsigned && mReturnType != AsmJsRetType::Floatish) || GetSymbolType() == AsmJsSymbol::MathBuiltinFunction); return mReturnType.toType().isSubType(val.toType()); } mReturnType = val; mReturnTypeKnown = true; return true; }
bool AsmJsFunctionDeclaration::CheckAndSetReturnType(Js::AsmJsRetType val) { const auto IsValid = [this](Js::AsmJsRetType val) { return AsmJsMathFunction::Is(this) || ( val != AsmJsRetType::Fixnum && val != AsmJsRetType::Unsigned && val != AsmJsRetType::Floatish ); }; Assert(IsValid(val)); if (mReturnTypeKnown) { Assert(IsValid(mReturnType)); return mReturnType.toType().isSubType(val.toType()); } mReturnType = val; mReturnTypeKnown = true; return true; }