Files
carbon-lang/executable_semantics/ast/BUILD
T
Jeremy G. Siek ac0b810bf3 Adds basic support for class functions and methods. (#1057)
* adding methods to the ast

* pre commit stuff?

* implementation of class functions

* implemented methods

* some cleanup

* more cleanup

* add newlines in test programs

* pre-commit fixups

* added include of return_term.h

* a test of a method calling another method

* replacing Member with Declaration

* removing the member.h etc files

* clarify a type annotation

* update uses of FunctionDeclaration

* remove ReturnTarget, no longer needed

* more cleanup

* more cleanup

* yet more cleanup, playing with pre-commit

* did a pre-commit run --all-files

* fixed const issue

* remove comment

* checking dependencies in BUILD files and headers

* pre-commit working now

* refactor NominalClassType to just hold a pointer to the class declaration

* remove Member from rtti

* responding to Geoffreys review

* change field_types to a non-member function
2022-02-05 12:30:13 -05:00

224 lines
4.9 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 = "declaration",
srcs = ["declaration.cpp"],
hdrs = [
"declaration.h",
],
deps = [
":ast_node",
":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 = [
":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",
":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"],
)