@neo-one/smart-contract-compiler-esnext-esm
Version:
NEO•ONE TypeScript smart contract compiler.
15 lines (13 loc) • 804 B
JavaScript
import { DiagnosticCode } from '../../../DiagnosticCode';
import { DiagnosticMessage } from '../../../DiagnosticMessage';
import { getHasBuiltins } from './getHasBuiltins';
export function handleTypeConversion(context, fromNode, fromType, toNode, toType) {
if (fromType !== undefined && toType !== undefined) {
const hasBuiltins = getHasBuiltins(context, fromNode, fromType);
const mismatch = hasBuiltins.some((hasBuiltin) => !hasBuiltin(context, toNode, toType));
if (mismatch) {
context.reportError(fromNode, DiagnosticCode.InvalidBuiltinUsage, DiagnosticMessage.InvalidBuiltinAssignment, context.typeChecker.typeToString(fromType, fromNode), context.typeChecker.typeToString(toType, toNode));
}
}
}
//# sourceMappingURL=handleTypeConversion.js.map