本文整理汇总了C#中Microsoft.Scripting.Interpreter.LightCompiler类的典型用法代码示例。如果您正苦于以下问题:C# LightCompiler类的具体用法?C# LightCompiler怎么用?C# LightCompiler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LightCompiler类属于Microsoft.Scripting.Interpreter命名空间,在下文中一共展示了LightCompiler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetInstruction
public virtual Instruction GetInstruction(LightCompiler compiler) {
compiler.Compile(_context);
if (_isLocal) {
return new LookupNameInstruction(_name);
} else {
return new LookupGlobalNameInstruction(_name);
}
}
开发者ID:octavioh,项目名称:ironruby,代码行数:8,代码来源:LightGlobalRewriter.cs
示例2: AddInstructions
public void AddInstructions(LightCompiler compiler) {
compiler.Compile(_target);
switch (Type.GetTypeCode(_binder.Type)) {
case TypeCode.Boolean:
compiler.Instructions.Emit(BooleanConversionInstruction.Instance);
break;
default:
compiler.Instructions.Emit(new TypedConversionInstruction(_binder.Type));
break;
}
}
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:11,代码来源:DynamicConvertExpression.cs
示例3: EnsureCompiled
private void EnsureCompiled(bool optimized) {
//TODO too much duplicated code between these two blocks
if (optimized) {
if (_optimizedCode != null) return;
var rewriter = new LightGlobalRewriter();
var newLambda = rewriter.RewriteLambda(Code, Code.Name, LanguageContext, optimized);
_optimizedScope = rewriter.Scope;
var compiler = new LightCompiler();
var interpreter = compiler.CompileTop(newLambda);
_optimizedCode = new LightLambda(interpreter);
} else {
if (_code != null) return;
var rewriter = new LightGlobalRewriter();
var newLambda = rewriter.RewriteLambda(Code, Code.Name, LanguageContext, optimized);
var compiler = new LightCompiler();
var interpreter = compiler.CompileTop(newLambda);
_code = new LightLambda(interpreter);
}
}
开发者ID:octavioh,项目名称:ironruby,代码行数:19,代码来源:LightScriptCode.cs
示例4: AddInstructions
public void AddInstructions(LightCompiler compiler) {
Instruction instr = DynamicInstructionN.CreateUntypedInstruction(_binder, ArgumentCount);
if (instr == null) {
var lightBinder = _binder as ILightCallSiteBinder;
if (lightBinder == null || !lightBinder.AcceptsArgumentArray) {
compiler.Compile(Reduce());
return;
}
Debug.Assert(Type == typeof(object));
instr = new DynamicSplatInstruction(ArgumentCount, CallSite<Func<CallSite, ArgumentArray, object>>.Create(_binder));
}
for (int i = 0; i < ArgumentCount; i++) {
compiler.Compile(GetArgument(i));
}
compiler.Instructions.Emit(instr);
}
开发者ID:rudimk,项目名称:dlr-dotnet,代码行数:19,代码来源:LightDynamicExpression.cs
示例5: AddInstructions
public override void AddInstructions(LightCompiler compiler)
{
if (Argument0.Type == typeof(CodeContext))
{
compiler.Compile(Argument0);
compiler.Compile(Argument1);
compiler.Instructions.EmitDynamic<CodeContext, object, object>(Binder);
}
else if (Argument1.Type == typeof(CodeContext))
{
// GetMember sites
compiler.Compile(Argument0);
compiler.Compile(Argument1);
compiler.Instructions.EmitDynamic<object, CodeContext, object>(Binder);
}
else
{
base.AddInstructions(compiler);
}
}
开发者ID:Alxandr,项目名称:IronTotem,代码行数:20,代码来源:TotemDynamicExpression.cs
示例6: GetExpression
internal override ParameterExpression GetExpression(LightCompiler compiler) {
return compiler.ClosureVariables[_index];
}
开发者ID:andreakn,项目名称:ironruby,代码行数:3,代码来源:LocalAccess.cs
示例7: ToString
public override string ToString(LightCompiler compiler) {
return InstructionName + "(" + GetExpression(compiler).Name + ": " + _index + ")";
}
开发者ID:andreakn,项目名称:ironruby,代码行数:3,代码来源:LocalAccess.cs
示例8: switch
void IInstructionProvider.AddInstructions(LightCompiler compiler) {
if (NeedComparisonTransformation()) {
// chained comparisons aren't supported for optimized light compiling
compiler.Compile(Reduce());
return;
}
switch (_op) {
case PythonOperator.Is:
compiler.Compile(_left);
compiler.Compile(_right);
compiler.Instructions.Emit(IsInstruction.Instance);
break;
case PythonOperator.IsNot:
compiler.Compile(_left);
compiler.Compile(_right);
compiler.Instructions.Emit(IsNotInstruction.Instance);
break;
default:
compiler.Compile(Reduce());
break;
}
}
开发者ID:rudimk,项目名称:dlr-dotnet,代码行数:23,代码来源:BinaryExpression.cs
示例9: GetDebugCookie
public virtual object GetDebugCookie(LightCompiler compiler) {
return null;
}
开发者ID:BenHall,项目名称:ironruby,代码行数:3,代码来源:Instruction.cs
示例10: AddInstructions
public void AddInstructions(LightCompiler compiler) {
compiler.Instructions.EmitLoad(_value);
}
开发者ID:jschementi,项目名称:iron,代码行数:3,代码来源:PythonConstantExpression.cs
示例11: AddInstructions
public void AddInstructions(LightCompiler compiler)
{
compiler.Compile(_value);
compiler.Instructions.Emit(new TotemSetGlobalInstruction(_global.Global));
}
开发者ID:Alxandr,项目名称:IronTotem-3.0,代码行数:5,代码来源:TotemGlobalVariableExpression.cs
示例12: AddInstructions
public void AddInstructions(LightCompiler compiler) {
compiler.Instructions.Emit(MakeClosureCellInstruction.Instance);
}
开发者ID:rudimk,项目名称:dlr-dotnet,代码行数:3,代码来源:ClosureExpression.cs
示例13: if
void IInstructionProvider.AddInstructions(LightCompiler compiler) {
if (_value is bool) {
compiler.Instructions.EmitLoad((bool)_value);
} else if (_value is UnicodeWrapper) {
compiler.Instructions.EmitLoad(((UnicodeWrapper)_value).Value);
} else {
compiler.Instructions.EmitLoad(_value);
}
}
开发者ID:jschementi,项目名称:iron,代码行数:9,代码来源:ConstantExpression.cs
示例14: AddInstructions
public override void AddInstructions(LightCompiler compiler) {
if (Argument0.Type == typeof(CodeContext)) {
compiler.Compile(Argument0);
compiler.Compile(Argument1);
compiler.Compile(Argument2);
compiler.Compile(Argument3);
compiler.Instructions.EmitDynamic<CodeContext, object, object, object, object>(Binder);
return;
} else {
base.AddInstructions(compiler);
}
}
开发者ID:jschementi,项目名称:iron,代码行数:12,代码来源:PythonDynamicExpression.cs
示例15:
void IInstructionProvider.AddInstructions(LightCompiler compiler) {
// optimizing bool conversions does no good in the light compiler
compiler.Compile(ReduceWorker(false));
}
开发者ID:jschementi,项目名称:iron,代码行数:4,代码来源:IfStatement.cs
示例16: LookupGlobalInstruction
void IInstructionProvider.AddInstructions(LightCompiler compiler)
{
compiler.Compile(_codeContextExpr);
compiler.Instructions.Emit(new LookupGlobalInstruction(_name, _isLocal, _lightThrow));
}
开发者ID:Alxandr,项目名称:IronTotem-3.0,代码行数:5,代码来源:TotemGlobalVariableExpression.cs
示例17: Label
public Label(LightCompiler compiler) {
this._compiler = compiler;
this._index = -1;
}
开发者ID:bclubb,项目名称:ironruby,代码行数:4,代码来源:LightCompiler.cs
示例18: AddInstructions
public void AddInstructions(LightCompiler compiler)
{
compiler.Compile(FunctionDefinition._functionParam);
compiler.Instructions.Emit(GetParentContextFromFunctionInstruction.Instance);
}
开发者ID:Alxandr,项目名称:IronTotem-3.0,代码行数:5,代码来源:GetParentContextFromFunctionExpression.cs
示例19: CompileLambdaExpression
private void CompileLambdaExpression(Expression expr) {
var node = (LambdaExpression)expr;
var compiler = new LightCompiler(this);
var interpreter = compiler.CompileTop(node);
int[] closureBoxes = new int[compiler._closureVariables.Count];
for (int i = 0; i < closureBoxes.Length; i++) {
var closureVar = compiler._closureVariables[i];
AddInstruction(GetBoxedVariable(closureVar));
}
AddInstruction(new CreateDelegateInstruction(node.Type, interpreter, compiler._closureVariables.Count));
}
开发者ID:bclubb,项目名称:ironruby,代码行数:12,代码来源:LightCompiler.cs
示例20: CompileAssignment
void IInstructionProvider.AddInstructions(LightCompiler compiler) {
if (_decorators != null) {
// decorators aren't supported, skip using the optimized instruction.
compiler.Compile(Reduce());
return;
}
// currently needed so we can later compile
MSAst.Expression funcCode = GlobalParent.Constant(GetOrMakeFunctionCode());
FuncCodeExpr = funcCode;
var variable = Parent.GetVariableExpression(_variable);
CompileAssignment(compiler, variable, CreateFunctionInstructions);
}
开发者ID:mstram,项目名称:ironruby,代码行数:15,代码来源:FunctionDefinition.cs
注:本文中的Microsoft.Scripting.Interpreter.LightCompiler类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论