本文整理汇总了C#中Microsoft.JScript.AST类的典型用法代码示例。如果您正苦于以下问题:C# AST类的具体用法?C# AST怎么用?C# AST使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AST类属于Microsoft.JScript命名空间,在下文中一共展示了AST类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Call
internal Call(Context context, AST func, ASTList args, bool inBrackets) : base(context)
{
this.func = func;
this.args = (args == null) ? new ASTList(context) : args;
this.argValues = null;
this.outParameterCount = 0;
int num = 0;
int count = this.args.count;
while (num < count)
{
if (this.args[num] is AddressOf)
{
this.outParameterCount++;
}
num++;
}
this.isConstructor = false;
this.inBrackets = inBrackets;
this.enclosingFunctionScope = null;
this.alreadyPartiallyEvaluated = false;
this.isAssignmentToDefaultIndexedProperty = false;
ScriptObject parent = base.Globals.ScopeStack.Peek();
while (!(parent is FunctionScope))
{
parent = parent.GetParent();
if (parent == null)
{
return;
}
}
this.enclosingFunctionScope = (FunctionScope) parent;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:Call.cs
示例2: FunctionExpression
internal FunctionExpression (AST parent, string name,
FormalParameterList p,
string return_type, Block body, Location location)
: base (parent, location)
{
func_obj = new FunctionObject (name, p, return_type, body, location);
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:FunctionExpression.cs
示例3: PostOrPrefixOperator
internal PostOrPrefixOperator(AST parent, AST operand, JSToken oper, bool prefix, Location location)
: base(parent, location)
{
this.operand = operand;
this.oper = oper;
this.prefix = prefix;
}
开发者ID:mayatforest,项目名称:Refractor,代码行数:7,代码来源:PostOrPrefixOperator.cs
示例4: PartiallyEvaluate
internal override AST PartiallyEvaluate()
{
if (this.leavesFinally)
{
base.context.HandleError(JSError.BadWayToLeaveFinally);
}
if (this.operand != null)
{
this.operand = this.operand.PartiallyEvaluate();
if (this.enclosingFunctionScope.returnVar != null)
{
if (this.enclosingFunctionScope.returnVar.type == null)
{
this.enclosingFunctionScope.returnVar.SetInferredType(this.operand.InferType(this.enclosingFunctionScope.returnVar), this.operand);
}
else
{
Binding.AssignmentCompatible(this.enclosingFunctionScope.returnVar.type.ToIReflect(), this.operand, this.operand.InferType(null), true);
}
}
else
{
base.context.HandleError(JSError.CannotReturnValueFromVoidFunction);
this.operand = null;
}
}
else if (this.enclosingFunctionScope.returnVar != null)
{
this.enclosingFunctionScope.returnVar.SetInferredType(Typeob.Object, null);
}
return this;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:Return.cs
示例5: If
internal If (AST parent, AST condition, AST true_stm, AST false_stm, Location location)
: base (parent, location)
{
this.cond = condition;
this.true_stm = true_stm;
this.false_stm = false_stm;
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:Statement.cs
示例6: PostOrPrefixOperator
internal PostOrPrefixOperator(Context context, AST operand, PostOrPrefix operatorTok)
: base(context, operand) {
this.operatorMeth = null;
this.operatorTok = operatorTok;
this.metaData = null;
this.type = null;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:7,代码来源:postorprefixoperator.cs
示例7: PartiallyEvaluate
internal override AST PartiallyEvaluate()
{
this.initializer = this.initializer.PartiallyEvaluate();
ScriptObject parent = base.Globals.ScopeStack.Peek();
while (parent is WithObject)
{
parent = parent.GetParent();
}
if (parent is FunctionScope)
{
FunctionScope scope = (FunctionScope) parent;
BitArray definedFlags = scope.DefinedFlags;
this.condition = this.condition.PartiallyEvaluate();
this.body = this.body.PartiallyEvaluate();
scope.DefinedFlags = definedFlags;
this.incrementer = this.incrementer.PartiallyEvaluate();
scope.DefinedFlags = definedFlags;
}
else
{
this.condition = this.condition.PartiallyEvaluate();
this.body = this.body.PartiallyEvaluate();
this.incrementer = this.incrementer.PartiallyEvaluate();
}
IReflect reflect = this.condition.InferType(null);
if ((reflect is FunctionPrototype) || (reflect == Typeob.ScriptFunction))
{
base.context.HandleError(JSError.SuspectLoopCondition);
}
return this;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:For.cs
示例8: If
internal If(Context context, AST condition, AST true_branch, AST false_branch)
: base(context) {
this.condition = condition;
this.operand1 = true_branch;
this.operand2 = false_branch;
this.completion = new Completion();
}
开发者ID:ArildF,项目名称:masters,代码行数:7,代码来源:if.cs
示例9: Try
internal Try (AST guarded_block, ArrayList catch_block, AST finally_block, AST parent, Location location)
: base (parent, location)
{
this.guarded_block = guarded_block;
this.catch_blocks = catch_block;
this.finally_block = finally_block;
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:Try.cs
示例10: PartiallyEvaluate
internal override AST PartiallyEvaluate()
{
if (this.operand != null)
{
this.operand = this.operand.PartiallyEvaluate();
}
else
{
BlockScope scope = null;
for (ScriptObject obj2 = base.Engine.ScriptObjectStackTop(); obj2 != null; obj2 = obj2.GetParent())
{
if (!(obj2 is WithObject))
{
scope = obj2 as BlockScope;
if ((scope == null) || scope.catchHanderScope)
{
break;
}
}
}
if (scope == null)
{
base.context.HandleError(JSError.BadThrow);
this.operand = new ConstantWrapper(null, base.context);
}
}
return this;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:Throw.cs
示例11: Try
internal Try(Context context, AST body, AST identifier, TypeExpression type, AST handler, AST finally_block, bool finallyHasControlFlowOutOfIt, Context tryEndContext)
: base(context) {
this.body = body;
this.type = type;
this.handler = handler;
this.finally_block = finally_block;
ScriptObject current_scope = (ScriptObject)Globals.ScopeStack.Peek();
while (current_scope is WithObject) //Can only happen at run time and only if there is an eval
current_scope = current_scope.GetParent();
this.handler_scope = null;
this.field = null;
if (identifier != null){
this.fieldName = identifier.ToString();
this.field = current_scope.GetField(this.fieldName, BindingFlags.Public|BindingFlags.Instance|BindingFlags.Static);
if (this.field != null){
if (type == null && (field is JSVariableField && field.IsStatic && ((JSVariableField)field).type == null) && !field.IsLiteral && !field.IsInitOnly)
return; //preserve legacy semantics by using the existing variable
if (((IActivationObject)current_scope).GetLocalField(this.fieldName) != null)
identifier.context.HandleError(JSError.DuplicateName, false);
}
this.handler_scope = new BlockScope(current_scope);
this.handler_scope.catchHanderScope = true;
JSVariableField f = this.handler_scope.AddNewField(identifier.ToString(), Missing.Value, FieldAttributes.Public); // must be a local
this.field = f; f.originalContext = identifier.context;
if (identifier.context.document.debugOn && this.field is JSLocalField){
this.handler_scope.AddFieldForLocalScopeDebugInfo((JSLocalField)this.field);
}
}
this.finallyHasControlFlowOutOfIt = finallyHasControlFlowOutOfIt;
this.tryEndContext = tryEndContext;
}
开发者ID:ArildF,项目名称:masters,代码行数:31,代码来源:try.cs
示例12: PartiallyEvaluate
internal override AST PartiallyEvaluate(){
this.field.attributeFlags &= ~FieldAttributes.InitOnly;
this.identifier.PartiallyEvaluateAsReference();
if (this.field.type != null)
this.field.type.PartiallyEvaluate();
ScriptObject scope = (ScriptObject)Globals.ScopeStack.Peek();
if (this.value != null){
this.value = this.value.PartiallyEvaluate();
this.identifier.SetPartialValue(this.value);
if (this.value is ConstantWrapper){
Object val = this.field.value = this.value.Evaluate();
if (this.field.type != null) this.field.value = Convert.Coerce(val, this.field.type, true);
if (this.field.IsStatic && (val is Type || val is ClassScope || val is TypedArray ||
Convert.GetTypeCode(val) != TypeCode.Object)){
this.field.attributeFlags |= FieldAttributes.Literal;
goto set_field_type;
}
}
this.field.attributeFlags |= FieldAttributes.InitOnly;
set_field_type:
if (this.field.type == null)
this.field.type = new TypeExpression(new ConstantWrapper(this.value.InferType(null), null));
}else{
this.value = new ConstantWrapper(null, this.context);
this.field.attributeFlags |= FieldAttributes.InitOnly;
}
// deal with custom attributes
if (this.field != null && this.field.customAttributes != null)
this.field.customAttributes.PartiallyEvaluate();
return this;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:31,代码来源:constant.cs
示例13: BinaryOp
internal BinaryOp (AST parent, AST left, AST right, JSToken op, Location location)
: base (parent, location)
{
operand1 = left;
operand2 = right;
operatorTok = op;
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:BinaryOp.cs
示例14: ForIn
internal ForIn (AST parent, AST lhs, AST obj, AST body, Location location)
: base (parent, location)
{
this.lhs = lhs;
this.obj = obj;
this.body = body;
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:ForIn.cs
示例15: Eval
internal Eval(Context context, AST operand, AST unsafeOption) : base(context)
{
this.operand = operand;
this.unsafeOption = unsafeOption;
ScriptObject obj2 = base.Globals.ScopeStack.Peek();
((IActivationObject) obj2).GetGlobalScope().evilScript = true;
if (obj2 is ActivationObject)
{
((ActivationObject) obj2).isKnownAtCompileTime = base.Engine.doFast;
}
if (obj2 is FunctionScope)
{
this.enclosingFunctionScope = (FunctionScope) obj2;
this.enclosingFunctionScope.mustSaveStackLocals = true;
for (ScriptObject obj3 = this.enclosingFunctionScope.GetParent(); obj3 != null; obj3 = obj3.GetParent())
{
FunctionScope scope = obj3 as FunctionScope;
if (scope != null)
{
scope.mustSaveStackLocals = true;
scope.closuresMightEscape = true;
}
}
}
else
{
this.enclosingFunctionScope = null;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:Eval.cs
示例16: Append
internal ASTList Append(AST elem){
int n = this.count++;
if (this.list.Length == n) this.Grow();
this.list[n] = elem;
this.context.UpdateWith(elem.context);
return this;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:7,代码来源:astlist.cs
示例17: PartiallyEvaluate
internal override AST PartiallyEvaluate(){
AST lhref = this.lhside.PartiallyEvaluateAsReference();
this.lhside = lhref;
this.rhside = this.rhside.PartiallyEvaluate();
lhref.SetPartialValue(this.rhside);
return this;
}
开发者ID:ArildF,项目名称:masters,代码行数:7,代码来源:assign.cs
示例18: ClassScope
internal ClassScope(AST name, GlobalScope scope) : base(scope)
{
this.name = name.ToString();
base.engine = scope.engine;
base.fast = scope.fast;
this.noExpando = true;
base.isKnownAtCompileTime = true;
this.owner = null;
this.constructors = new JSConstructor[0];
ScriptObject parent = base.engine.ScriptObjectStackTop();
while (parent is WithObject)
{
parent = parent.GetParent();
}
if (parent is ClassScope)
{
this.package = ((ClassScope) parent).GetPackage();
}
else if (parent is PackageScope)
{
this.package = (PackageScope) parent;
}
else
{
this.package = null;
}
this.itemProp = null;
this.outerClassField = null;
this.inStaticInitializerCode = false;
this.staticInitializerUsesEval = false;
this.instanceInitializerUsesEval = false;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:ClassScope.cs
示例19: PartiallyEvaluate
internal override AST PartiallyEvaluate()
{
AST ast = this.lhside.PartiallyEvaluateAsReference();
this.lhside = ast;
this.rhside = this.rhside.PartiallyEvaluate();
ast.SetPartialValue(this.rhside);
return this;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:Assign.cs
示例20: For
internal For(Context context, AST initializer, AST condition, AST incrementer, AST body) : base(context)
{
this.initializer = initializer;
this.condition = condition;
this.incrementer = incrementer;
this.body = body;
this.completion = new Completion();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:For.cs
注:本文中的Microsoft.JScript.AST类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论