-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Interceptors #456
Comments
https://ufcpp.net/blog/2024/2/interceptors/ ブログにはした。 |
https://ufcpp.net/blog/2024/2/interceptors/ 実際、パスを使うのはやめるっぽい。 |
location specifier 使う路線、いまだ Experimental だった。 using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
var code = /* lang=c#-test */"""
var x = int.Parse("123");
""";
var tree = CSharpSyntaxTree.ParseText(code, path: "a.cs");
var compilation = CSharpCompilation.Create("", [tree]);
var sem = compilation.GetSemanticModel(tree);
var root = await tree.GetRootAsync();
var parse = root.FindNode(new(13, 1));
var x = (InvocationExpressionSyntax)parse.Parent.Parent;
#pragma warning disable RSEXPERIMENTAL002
var loc = sem.GetInterceptableLocation(x);
#pragma warning restore RSEXPERIMENTAL002
Console.WriteLine(loc.Version);
Console.WriteLine(loc.Data);
var decoded = Convert.FromBase64String(loc.Data);
foreach (var b in decoded)
{
Console.Write($"{b:X2} ");
}
Console.WriteLine(); |
だいぶ前からだけども、global な型には Interceptor メソッド定義できない。 |
C# 13 で、
|
C# 12 時点で preview feature。オプション指定必須。
ufcpp-live/UfcppLiveAgenda#74 (comment)
The text was updated successfully, but these errors were encountered: