本文整理汇总了C#中Microsoft.JScript.AST类的典型用法代码示例。如果您正苦于以下问题:C# AST类的具体用法?C# AST怎么用?C# AST使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AST类属于Microsoft.JScript命名空间,在下文中一共展示了AST类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例13: BinaryOp
internal BinaryOp (AST parent, AST left, AST right, JSToken op, Location location)
: base (parent, location)
{
operand1 = left;
operand2 = right;
operatorTok = op;
}
示例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;
}
示例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;
}
}