mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Initial support for builtin functions. (#3803)
For now, a builtin function is defined by specifying a string literal initializer in a function declaration: ```carbon fn MyBuiltin(a: i32) -> i32 = "builtin.name"; ``` End-to-end support is included for a sample `"int.add"` builtin performing integer addition, covering constant evaluation and code generation. The implementation here needs substantial refactoring before we'll be ready to start adding more builtins. That refactoring work will be coming next. This change is aiming to checkpoint some incremental progress.
This commit is contained in:
@@ -424,6 +424,7 @@ class NodeStack {
|
||||
case Parse::NodeKind::WhileConditionStart:
|
||||
return Id::KindFor<SemIR::InstBlockId>();
|
||||
case Parse::NodeKind::FunctionDefinitionStart:
|
||||
case Parse::NodeKind::BuiltinFunctionDefinitionStart:
|
||||
return Id::KindFor<SemIR::FunctionId>();
|
||||
case Parse::NodeKind::ClassDefinitionStart:
|
||||
return Id::KindFor<SemIR::ClassId>();
|
||||
@@ -434,6 +435,7 @@ class NodeStack {
|
||||
case Parse::NodeKind::SelfValueName:
|
||||
return Id::KindFor<SemIR::NameId>();
|
||||
case Parse::NodeKind::ArrayExprSemi:
|
||||
case Parse::NodeKind::BuiltinName:
|
||||
case Parse::NodeKind::ClassIntroducer:
|
||||
case Parse::NodeKind::CodeBlockStart:
|
||||
case Parse::NodeKind::ExprOpenParen:
|
||||
|
||||
Reference in New Issue
Block a user