New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow concatenation of tuples that contain a mix of runtime and comptime values #4573
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alexnask
changed the title
Allow tuple concatenation of tuples that contain a mix of runtime and comptime values
Allow concatenation of tuples that contain a mix of runtime and comptime values
Feb 28, 2020
on macOS, latest Xcode/clang:
diff --git a/src/ir.cpp b/src/ir.cpp
index 5855f0a08..f4b2ad364 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -16961,8 +16961,6 @@ static IrInstGen *ir_analyze_tuple_cat(IrAnalyze *ira, IrInst* source_instr,
new_type->data.structure.special = StructSpecialInferredTuple;
new_type->data.structure.resolve_status = ResolveStatusBeingInferred;
- bool is_comptime = ir_should_inline(ira->old_irb.exec, source_instr->scope);
-
IrInstGen *new_struct_ptr = ir_resolve_result(ira, source_instr, no_result_loc(),
new_type, nullptr, false, true);
uint32_t new_field_count = op1_field_count + op2_field_count; |
Thanks, will update soon. |
Confirmed that it fix the issue I had to make COM call more natural Without this PR fn comCall(comptime name: []const u8, args: var) comFindReturnType(comFindVtableType(@TypeOf(args[0])), name) {
if (@field(args[0].lpVtbl[0], name)) |func| {
return @call(.{}, func, args);
}
return undefined;
}
fn createRenderTarget() void {
var pBackBuffer: ?*dx.ID3D11Texture2D = null;
if (dxContext.swapChain) |swapChain| {
_ = comCall("GetBuffer" , "GetBuffer", .{ swapChain, 0, &dx.IID_ID3D11Texture2D, @ptrCast([*c]?*c_void, &pBackBuffer) });
}
if (dxContext.device) |device| {
_ = comCall("CreateRenderTargetView", .{ device, @ptrCast([*c]dx.struct_ID3D11Resource, pBackBuffer), null, @ptrCast([*c][*c]dx.struct_ID3D11RenderTargetView, &dxContext.mainRenderTargetView) });
}
if (pBackBuffer) |backBuffer| {
_ = comCall("Release", .{backBuffer});
}
} With this PR: fn comCall(self: var, comptime name: []const u8, args: var) comFindReturnType(comFindVtableType(@TypeOf(self)), name) {
if (@field(self.lpVtbl[0], name)) |func| {
return @call(.{}, func, .{self} ++ args);
}
return undefined;
}
fn createRenderTarget() void {
var pBackBuffer: ?*dx.ID3D11Texture2D = null;
if (dxContext.swapChain) |swapChain| {
_ = comCall(swapChain, "GetBuffer", .{ 0, &dx.IID_ID3D11Texture2D, @ptrCast([*c]?*c_void, &pBackBuffer) });
}
if (dxContext.device) |device| {
_ = comCall(device, "CreateRenderTargetView", .{ @ptrCast([*c]dx.struct_ID3D11Resource, pBackBuffer), null, @ptrCast([*c][*c]dx.struct_ID3D11RenderTargetView, &dxContext.mainRenderTargetView) });
}
if (pBackBuffer) |backBuffer| {
_ = comCall(backBuffer, "Release", .{});
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #4571.