Esempio n. 1
0
func errIfNotFloatType(i ssa.Instruction, t types.Type) error {
	_, ok := t.(*types.Float)
	if !ok {
		return &InstrError{
			Instr:   i,
			Message: "Expected float type, found `" + t.String() + "`",
		}
	}
	return nil
}
Esempio n. 2
0
func errIfNotPointerType(i ssa.Instruction, t types.Type) error {
	_, ok := t.(*types.Pointer)
	if !ok {
		return &InstrError{
			Instr:   i,
			Message: "Expected pointer type, found `" + t.String() + "`",
		}
	}
	return nil
}
Esempio n. 3
0
func checkMismatchedTypesGlobal(t1, t2 types.Type, g *ssa.Global) error {
	if !t1.Equals(t2) {
		return &GlobalError{
			Global:  g,
			Message: "Mismatched types: `" + t1.String() + "` and `" + t2.String() + "`",
		}
	}

	return nil
}