Closed bloody76 closed 7 years ago
Reviewed 20 of 20 files at r1. Review status: all files reviewed at latest revision, 3 unresolved discussions.
src/codegen/codegen_function.cc, line 47 at r1 (raw file):
llvm_function->setCallingConv(CallingConv::C); // Name the parameters.
Add an assert that the two lists are the same size. And you don't need std::
for begin and end, because of argument-dependent lookup.
test/resources/ir/function_with_arg.gh, line 1 at r1 (raw file):
fun main(a: Int) {
Int32, until we have type aliases
test/resources/ir/function_with_args.gh, line 1 at r1 (raw file):
fun main(a: Int, b: Int) {
I'm not super fond of calling them main
, since we'll eventually enforce a signature for main
Comments from Reviewable
Review status: 6 of 20 files reviewed at latest revision, 3 unresolved discussions.
test/resources/ir/function_with_args.gh, line 1 at r1 (raw file):
I'm not super fond of calling them `main`, since we'll eventually enforce a signature for main
Done.
Comments from Reviewable
Review status: 6 of 20 files reviewed at latest revision, 3 unresolved discussions.
test/resources/ir/function_with_arg.gh, line 1 at r1 (raw file):
Int32, until we have type aliases
Done.
Comments from Reviewable
Review status: 5 of 20 files reviewed at latest revision, 3 unresolved discussions.
src/codegen/codegen_function.cc, line 47 at r1 (raw file):
Add an assert that the two lists are the same size. And you don't need `std::` for begin and end, because of argument-dependent lookup.
Done.
Comments from Reviewable
Sorry, how did I miss that? The syntax has a val
or mut
:
fun test(val a : Int32)
Review status: 5 of 20 files reviewed at latest revision, all discussions resolved.
Comments from Reviewable
Done !
Review status: 2 of 21 files reviewed at latest revision, all discussions resolved.
Comments from Reviewable
Reviewed 2 of 20 files at r2. Review status: 4 of 22 files reviewed at latest revision, 4 unresolved discussions.
src/ast/function_argument_declaration.h, line 13 at r2 (raw file):
FunctionArgumentDeclaration(lexer::Range location, Identifier id, Type type, bool mut) : ASTNode(std::move(location)),
Why not have it be a variable declaration? or contain one? Or extract the common part into an abstract class? There's much overlap here (intentionally, I might add)
src/parser/parser.cc, line 223 at r2 (raw file):
if (!value.is_ok() && !type.is_ok()) { return ParseError("Expected either a type, either a value to infer from",
either/or, not either/either. And no comma: "Expected either a type or a default value to infer from"
src/parser/parser.cc, line 303 at r2 (raw file):
arguments.push_back(std::make_unique<ast::FunctionArgumentDeclaration>( location.range(), val_decl->id(), std::move(val_decl->type().value_or_die()), val_decl->is_mutable()));
You don't know if there is a type, you can't use value_or_die()
tools/clang-format.sh, line 14 at r2 (raw file):
FORMAT_CMD="clang-format -style=Google" FIND_CMD="find ${PROJECT_DIR}/src/ ${PROJECT_DIR}/test/ -regex '.*\.[hc]\{1,2\}' -type f"
Will have to rebase after PR #44 is merged
Comments from Reviewable
Review status: 4 of 22 files reviewed at latest revision, 4 unresolved discussions.
src/ast/function_argument_declaration.h, line 13 at r2 (raw file):
Why not have it be a variable declaration? or contain one? Or extract the common part into an abstract class? There's much overlap here (intentionally, I might add)
It would be much better indeed, I just have issues regarding the pretty printer, I will give it another try, maybe last time I was tired.
Comments from Reviewable
Review status: 0 of 32 files reviewed at latest revision, 4 unresolved discussions.
src/parser/parser.cc, line 223 at r2 (raw file):
either/or, not either/either. And no comma: "Expected either a type or a default value to infer from"
Done.
src/parser/parser.cc, line 303 at r2 (raw file):
You don't know if there is a type, you can't use value_or_die()
Done.
tools/clang-format.sh, line 14 at r2 (raw file):
Will have to rebase after PR #44 is merged
Yup
Comments from Reviewable
Review status: 0 of 31 files reviewed at latest revision, 6 unresolved discussions.
src/ast/function_argument_declaration.h, line 16 at r3 (raw file):
Option<std::unique_ptr<Value>> value, bool mut) : VariableDeclaration(std::move(location), std::move(id), std::move(type), std::move(value), mut) {}
I would put an assert that we have at least either a type or a value.
src/parser/parser.cc, line 201 at r3 (raw file):
template <class Declaration> Parser::ErrorOrPtr<Declaration> Parser::parse_variable_declaration() { static_assert(std::is_base_of<ast::VariableDeclaration, Declaration>::value,
I like that :)
tools/clang-format.sh, line 14 at r2 (raw file):
Yup
Meanwhile, can you remove this change from the PR?
Comments from Reviewable
Review status: 0 of 31 files reviewed at latest revision, 5 unresolved discussions.
src/ast/function_argument_declaration.h, line 16 at r3 (raw file):
I would put an assert that we have at least either a type or a value.
Indeed, I put it at the parse_variable_declaration level but I will do it here also !
Comments from Reviewable
Review status: 0 of 30 files reviewed at latest revision, 5 unresolved discussions, some commit checks failed.
src/ast/function_argument_declaration.h, line 16 at r3 (raw file):
Indeed, I put it at the parse_variable_declaration level but I will do it here also !
Done.
tools/clang-format.sh, line 14 at r2 (raw file):
Meanwhile, can you remove this change from the PR?
Done.
Comments from Reviewable
Review status: 0 of 30 files reviewed at latest revision, 1 unresolved discussion.
src/ast/function_argument_declaration.h, line 16 at r3 (raw file):
Done.
Erm, I don't see it...
Comments from Reviewable
Review status: 0 of 30 files reviewed at latest revision, 1 unresolved discussion.
src/ast/function_argument_declaration.h, line 16 at r3 (raw file):
Erm, I don't see it...
its in variable_declaration.h, this way we assert for all the kind of variable declaration
Comments from Reviewable
Review status: 0 of 30 files reviewed at latest revision, 1 unresolved discussion.
src/ast/function_argument_declaration.h, line 16 at r3 (raw file):
its in variable_declaration.h, this way we assert for all the kind of variable declaration
OK, Got it
Comments from Reviewable
This change is