本文整理汇总了C#中Galaxy_Editor_2.Compiler.Generated.node.AMethodDecl.SetNative方法的典型用法代码示例。如果您正苦于以下问题:C# AMethodDecl.SetNative方法的具体用法?C# AMethodDecl.SetNative怎么用?C# AMethodDecl.SetNative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Galaxy_Editor_2.Compiler.Generated.node.AMethodDecl
的用法示例。
在下文中一共展示了AMethodDecl.SetNative方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadLibraries
/// <summary>
/// Crawls the StarCraft 2 MPQs to grab the *.galaxy files inside. These files are parsed for (native) functions and constants.
/// </summary>
/// <returns>The functions and constants of StarCraft 2 in form of a LibraryData</returns>
LibraryData loadLibraries()
{
// parse the files for functions and constants
CrawlAndParseMpqs();
// convert the functions and constants to a LibraryData format
LibraryData lib = new LibraryData();
// create the methods with from crawled info
foreach (ParsedFunction function in functions)
{
AMethodDecl method = new AMethodDecl();
if (function.IsNative)
method.SetNative(new TNative("native"));
method.SetName(new TIdentifier(function.Name));
method.SetReturnType(new ANamedType(new TIdentifier(function.ReturnType), null));
// add function parameter
foreach (var parameter in function.Parameters)
{
method.GetFormals().Add(new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null,
new ANamedType(new TIdentifier(parameter.Item1), null),
new TIdentifier(parameter.Item2), null));
}
lib.Methods.Add(method);
}
// create the constants from the crawled info
foreach (ParsedConstant constant in constants)
{
AFieldDecl field = new AFieldDecl(new APublicVisibilityModifier(), null, new TConst("const"),
new ANamedType(new TIdentifier(constant.Type), null),
new TIdentifier(constant.Name), new AStringConstExp(new TStringLiteral(constant.Value)));
lib.Fields.Add(field);
}
functions.Clear();
constants.Clear();
return lib;
}