# encoding: utf-8 # frozen_string_literal: true module Carbon module Compiler module Visitor class Generation module Asserts def assert_type_equal(found, expected, location: Location.default) return unless found != expected @file.emit("Expression/Type/Mismatch", location, [found, expected]) end def assert_type_void(found, location: Location.default) assert_type_equal(found, Carbon::Void, location: location) end def assert_type_boolean(found, location: Location.default) assert_type_equal(found, Carbon::Boolean, location: location) end def assert_nolocal(name, context, location: Location.default) return unless context.key?(name) @file.emit("Statement/Let/Redefine", location, [name]) end end end end end end