Sha256: 94c9e6a7028f1da105392b5a584ba979e7e53baef3a91cf75d49074f6b93aed1

Contents?: true

Size: 910 Bytes

Versions: 1

Compression:

Stored size: 910 Bytes

Contents

# 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carbon-compiler-0.2.0 lib/carbon/compiler/visitor/generation/asserts.rb