當前位置: 首頁>>代碼示例>>C#>>正文


C# JScript.AST類代碼示例

本文整理匯總了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;
 }
開發者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


注:本文中的Microsoft.JScript.AST類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。