本文整理汇总了C#中JavaCompiler.Compilation.ByteCode.ByteCodeGenerator.Kill方法的典型用法代码示例。如果您正苦于以下问题:C# ByteCodeGenerator.Kill方法的具体用法?C# ByteCodeGenerator.Kill怎么用?C# ByteCodeGenerator.Kill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JavaCompiler.Compilation.ByteCode.ByteCodeGenerator
的用法示例。
在下文中一共展示了ByteCodeGenerator.Kill方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendStrings
public static void AppendStrings(ByteCodeGenerator generator, DefinedType sb, ExpressionNode node)
{
if (node is AdditiveNode)
{
var addNode = node as AdditiveNode;
generator.Kill();
var addType = new AdditiveCompiler(addNode).Compile(generator).Type;
generator.Revive();
if (addType.Name == BuiltinTypes.String.Name)
{
AppendStrings(generator, sb, addNode.LeftChild.Child);
AppendStrings(generator, sb, addNode.RightChild.Child);
return;
}
}
var item = new ExpressionCompiler(node).Compile(generator);
var appendMethod = sb.FindMethod(generator, "append", new List<Type> { item.Type });
if (appendMethod == null) throw new InvalidOperationException();
item.Load();
new MemberItem(generator, appendMethod, false).Invoke();
}
示例2: CompileMethod
private static Item CompileMethod(ByteCodeGenerator generator, DefinedType parentType, PrimaryNode.TermMethodExpression id)
{
generator.Kill();
var args = id.Arguments.Select(parameter => new TranslationCompiler(parameter).Compile(generator).Type).ToList();
generator.Revive();
var method = parentType.FindMethod(generator, id.Identifier, args);
if (method == null) throw new InvalidOperationException();
foreach (var arg in method.Parameters.Zip(id.Arguments, (dst, src) => new { dst, src }))
{
new TranslationCompiler(arg.src, arg.dst.Type).Compile(generator).Load();
}
var isSuper = false;
if (generator.Method.DeclaringType is Class)
{
isSuper = parentType == ((Class)generator.Method.DeclaringType).Super;
}
var item = method.Modifiers.HasFlag(Modifier.Static)
? (Item)new StaticItem(generator, method)
: new MemberItem(generator, method, method.Name == "<init>" || isSuper);
return item.Invoke();
}