mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
* interfaces, impls, and constrained generics (basics) * separate type checking into declare vs. type check, removing redundancy * external impls * added impl scopes to handle generics calling generics * cleanup * more cleanup * Update executable_semantics/testdata/interface/external_impl_point_vector.carbon Co-authored-by: josh11b <josh11b@users.noreply.github.com> * Update executable_semantics/testdata/interface/generic_call_generic.carbon Co-authored-by: josh11b <josh11b@users.noreply.github.com> * Update executable_semantics/testdata/interface/tuple_vector_add_scale.carbon Co-authored-by: josh11b <josh11b@users.noreply.github.com> * Update executable_semantics/testdata/interface/vector_point_add_scale.carbon Co-authored-by: josh11b <josh11b@users.noreply.github.com> * change ImplementationDeclaration to ImplDeclaration * remove impl_type_value * split NamedEntity into two * changed GetName to be a free function * adding comments * more edits to respond to review * introduce ImplBinding, remove punning on GenericBinding * new test case and some minor edits * refactor GetMember and GetField to move impl logic to interpreter * remove commennt * change EntityView to ImplBinding in FieldAccess... * move ImplBinding * review response * added example to impl_scope.h * minor edits * Update executable_semantics/interpreter/field_path.h Co-authored-by: Geoff Romer <gromer@google.com> * Update executable_semantics/interpreter/value.cpp Co-authored-by: Geoff Romer <gromer@google.com> * Update executable_semantics/interpreter/interpreter.cpp Co-authored-by: Geoff Romer <gromer@google.com> * Update executable_semantics/ast/expression.h Co-authored-by: Geoff Romer <gromer@google.com> * Update executable_semantics/ast/expression.h Co-authored-by: Geoff Romer <gromer@google.com> * Update executable_semantics/ast/generic_binding.h Co-authored-by: Geoff Romer <gromer@google.com> * more edits from review * review response * Update executable_semantics/ast/static_scope.h Co-authored-by: Geoff Romer <gromer@google.com> * remove ImplType, renamed node_view to value_node Co-authored-by: josh11b <josh11b@users.noreply.github.com> Co-authored-by: Geoff Romer <gromer@google.com>
243 lines
5.3 KiB
Python
243 lines
5.3 KiB
Python
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
# Exceptions. See /LICENSE for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
package(default_visibility = ["//executable_semantics:__subpackages__"])
|
|
|
|
cc_library(
|
|
name = "ast",
|
|
hdrs = ["ast.h"],
|
|
deps = [
|
|
":declaration",
|
|
":library_name",
|
|
"//executable_semantics/common:nonnull",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "ast_node",
|
|
srcs = ["ast_node.cpp"],
|
|
hdrs = [
|
|
"ast_node.h",
|
|
"ast_rtti.h",
|
|
],
|
|
deps = [
|
|
":source_location",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
genrule(
|
|
name = "ast_rtti",
|
|
srcs = ["ast_rtti.txt"],
|
|
outs = ["ast_rtti.h"],
|
|
cmd = "./$(location //executable_semantics:gen_rtti)" +
|
|
" $(location ast_rtti.txt) > \"$@\"",
|
|
tools = ["//executable_semantics:gen_rtti"],
|
|
)
|
|
|
|
cc_library(
|
|
name = "ast_test_matchers",
|
|
testonly = 1,
|
|
srcs = [
|
|
"ast_test_matchers_internal.cpp",
|
|
"ast_test_matchers_internal.h",
|
|
],
|
|
hdrs = ["ast_test_matchers.h"],
|
|
deps = [
|
|
":ast",
|
|
":ast_node",
|
|
":declaration",
|
|
":expression",
|
|
":statement",
|
|
"@com_google_googletest//:gtest",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "ast_test_matchers_test",
|
|
srcs = ["ast_test_matchers_test.cpp"],
|
|
deps = [
|
|
":ast_test_matchers",
|
|
":declaration",
|
|
":expression",
|
|
":pattern",
|
|
":statement",
|
|
"//executable_semantics/common:arena",
|
|
"@com_google_googletest//:gtest_main",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "generic_binding",
|
|
hdrs = [
|
|
"generic_binding.h",
|
|
],
|
|
deps = [
|
|
":ast_node",
|
|
":source_location",
|
|
":value_category",
|
|
"//common:check",
|
|
"//common:ostream",
|
|
"//executable_semantics/common:nonnull",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "declaration",
|
|
srcs = ["declaration.cpp"],
|
|
hdrs = [
|
|
"declaration.h",
|
|
],
|
|
deps = [
|
|
":ast_node",
|
|
":generic_binding",
|
|
":pattern",
|
|
":return_term",
|
|
":source_location",
|
|
":statement",
|
|
":static_scope",
|
|
":value_category",
|
|
"//common:ostream",
|
|
"//executable_semantics/common:nonnull",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "return_term",
|
|
hdrs = ["return_term.h"],
|
|
deps = [
|
|
":expression",
|
|
":source_location",
|
|
"//common:check",
|
|
"//common:ostream",
|
|
"//executable_semantics/common:nonnull",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "expression",
|
|
srcs = ["expression.cpp"],
|
|
hdrs = ["expression.h"],
|
|
deps = [
|
|
":ast_node",
|
|
":generic_binding",
|
|
":paren_contents",
|
|
":source_location",
|
|
":static_scope",
|
|
":value_category",
|
|
"//common:indirect_value",
|
|
"//common:ostream",
|
|
"//executable_semantics/common:arena",
|
|
"//executable_semantics/common:error",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "expression_test",
|
|
srcs = ["expression_test.cpp"],
|
|
deps = [
|
|
":expression",
|
|
":paren_contents",
|
|
"//executable_semantics/common:arena",
|
|
"@com_google_googletest//:gtest_main",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "library_name",
|
|
hdrs = ["library_name.h"],
|
|
)
|
|
|
|
cc_library(
|
|
name = "paren_contents",
|
|
hdrs = ["paren_contents.h"],
|
|
deps = [
|
|
":source_location",
|
|
"//executable_semantics/common:error",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "pattern",
|
|
srcs = ["pattern.cpp"],
|
|
hdrs = ["pattern.h"],
|
|
deps = [
|
|
":ast_node",
|
|
":expression",
|
|
":source_location",
|
|
":static_scope",
|
|
":value_category",
|
|
"//common:ostream",
|
|
"//executable_semantics/common:arena",
|
|
"//executable_semantics/common:error",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "pattern_test",
|
|
srcs = ["pattern_test.cpp"],
|
|
deps = [
|
|
":expression",
|
|
":paren_contents",
|
|
":pattern",
|
|
"//executable_semantics/common:arena",
|
|
"@com_google_googletest//:gtest_main",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "static_scope",
|
|
srcs = ["static_scope.cpp"],
|
|
hdrs = ["static_scope.h"],
|
|
deps = [
|
|
":ast_node",
|
|
":source_location",
|
|
":value_category",
|
|
"//common:check",
|
|
"//executable_semantics/common:error",
|
|
"//executable_semantics/common:nonnull",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "source_location",
|
|
hdrs = ["source_location.h"],
|
|
deps = [
|
|
"//common:ostream",
|
|
"//executable_semantics/common:nonnull",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "statement",
|
|
srcs = ["statement.cpp"],
|
|
hdrs = ["statement.h"],
|
|
deps = [
|
|
":ast_node",
|
|
":expression",
|
|
":pattern",
|
|
":return_term",
|
|
":source_location",
|
|
":static_scope",
|
|
":value_category",
|
|
"//common:check",
|
|
"//common:ostream",
|
|
"//executable_semantics/common:arena",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "value_category",
|
|
hdrs = ["value_category.h"],
|
|
)
|