当前位置: 首页>>代码示例>>C#>>正文


C# BlockStatement.GetRegion方法代码示例

本文整理汇总了C#中BlockStatement.GetRegion方法的典型用法代码示例。如果您正苦于以下问题:C# BlockStatement.GetRegion方法的具体用法?C# BlockStatement.GetRegion怎么用?C# BlockStatement.GetRegion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BlockStatement的用法示例。


在下文中一共展示了BlockStatement.GetRegion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompileMethod

 public JsFunctionDefinitionExpression CompileMethod(IList<IParameter> parameters, IDictionary<IVariable, VariableData> variables, BlockStatement body, bool staticMethodWithThisAsFirstArgument)
 {
     SetRegion(body.GetRegion());
     try {
         _result = MethodCompiler.FixByRefParameters(parameters, variables);
         VisitChildren(body);
         JsBlockStatement jsbody;
         if (_result.Count == 1 && _result[0] is JsBlockStatement)
             jsbody = (JsBlockStatement)_result[0];
         else
             jsbody = new JsBlockStatement(_result);
         return JsExpression.FunctionDefinition((staticMethodWithThisAsFirstArgument ? new[] { _namer.ThisAlias } : new string[0]).Concat(parameters.Select(p => variables[p].Name)), jsbody);
     }
     catch (Exception ex) {
         _errorReporter.InternalError(ex);
         return JsExpression.FunctionDefinition(new string[0], JsBlockStatement.EmptyStatement);
     }
 }
开发者ID:jack128,项目名称:SaltarelleCompiler,代码行数:18,代码来源:StatementCompiler.cs

示例2: CompileMethod

		public JsFunctionDefinitionExpression CompileMethod(IList<IParameter> parameters, IDictionary<IVariable, VariableData> variables, BlockStatement body, bool staticMethodWithThisAsFirstArgument, bool expandParams, StateMachineType stateMachineType, IType iteratorBlockYieldTypeOrAsyncTaskGenericArgument = null) {
			SetRegion(body.GetRegion());
			try {
				_result = MethodCompiler.PrepareParameters(parameters, variables, expandParams: expandParams, staticMethodWithThisAsFirstArgument: staticMethodWithThisAsFirstArgument);
				VisitChildren(body);
				JsBlockStatement jsbody;
				if (_result.Count == 1 && _result[0] is JsBlockStatement)
					jsbody = (JsBlockStatement)_result[0];
				else
					jsbody = JsStatement.Block(_result);

				var result = JsExpression.FunctionDefinition((staticMethodWithThisAsFirstArgument ? new[] { _namer.ThisAlias } : new string[0]).Concat(parameters.Where((p, i) => i != parameters.Count - 1 || !expandParams).Select(p => variables[p].Name)), jsbody);

				switch (stateMachineType) {
					case StateMachineType.NormalMethod:
						result = StateMachineRewriteNormalMethod(result);
						break;

					case StateMachineType.IteratorBlockReturningIEnumerable:
					case StateMachineType.IteratorBlockReturningIEnumerator:
						result = StateMachineRewriteIteratorBlock(result, stateMachineType == StateMachineType.IteratorBlockReturningIEnumerable, iteratorBlockYieldTypeOrAsyncTaskGenericArgument);
						break;

					case StateMachineType.AsyncVoid:
					case StateMachineType.AsyncTask:
						result = StateMachineRewriteAsyncMethod(result, stateMachineType == StateMachineType.AsyncTask, iteratorBlockYieldTypeOrAsyncTaskGenericArgument);
						break;

					default:
						throw new ArgumentException("stateMachineType");
				}

	            return result;
			}
			catch (Exception ex) {
				_errorReporter.InternalError(ex);
	            return JsExpression.FunctionDefinition(new string[0], JsStatement.EmptyBlock); 
			}
		}
开发者ID:chenxustu1,项目名称:SaltarelleCompiler,代码行数:39,代码来源:StatementCompiler.cs

示例3: CompileMethod

 public JsFunctionDefinitionExpression CompileMethod(IList<IParameter> parameters, IDictionary<IVariable, VariableData> variables, BlockStatement body)
 {
     _filename = body.GetRegion().FileName;
     try {
         _result = MethodCompiler.FixByRefParameters(parameters, variables);
         VisitChildren(body);
         JsBlockStatement jsbody;
         if (_result.Count == 1 && _result[0] is JsBlockStatement)
             jsbody = (JsBlockStatement)_result[0];
         else
             jsbody = new JsBlockStatement(_result);
         return JsExpression.FunctionDefinition(parameters.Select(p => variables[p].Name), jsbody);
     }
     catch (Exception ex) {
         _errorReporter.InternalError(ex, _filename, _location);
         return JsExpression.FunctionDefinition(new string[0], JsBlockStatement.EmptyStatement);
     }
 }
开发者ID:arnauddias,项目名称:SaltarelleCompiler,代码行数:18,代码来源:StatementCompiler.cs


注:本文中的BlockStatement.GetRegion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。