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


C# Analyzer.LeaveActParam方法代碼示例

本文整理匯總了C#中Analyzer.LeaveActParam方法的典型用法代碼示例。如果您正苦於以下問題:C# Analyzer.LeaveActParam方法的具體用法?C# Analyzer.LeaveActParam怎麽用?C# Analyzer.LeaveActParam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Analyzer的用法示例。


在下文中一共展示了Analyzer.LeaveActParam方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Analyze

            public void Analyze(ActualParam/*!*/node, Analyzer/*!*/ analyzer, bool isBaseCtorCallConstrained)
            {
                // TODO: isBaseCtorCallConstrained

                ExInfoFromParent info = new ExInfoFromParent(node);

                analyzer.EnterActParam();

                if (node.IsVariadic) throw new NotImplementedException();

                if (analyzer.ActParamDeclIsUnknown())
                {
                    // we don't know whether the parameter will be passed by reference at run-time:
                    if (node.Expression.AllowsPassByReference)
                    {
                        info.Access = AccessType.ReadUnknown;

                        // Although we prepare to pass reference, value can be really passed.
                        // That's why we report warning when user use '&' in calling, 
                        // because it has no influence.
                        if (node.Ampersand)
                            analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, node.Span);
                    }
                    else
                    {
                        info.Access = AccessType.Read;
                    }
                }
                else
                {
                    if (analyzer.ActParamPassedByRef())
                    {
                        if (node.Expression.AllowsPassByReference)
                        {
                            info.Access = AccessType.ReadRef;
                        }
                        else
                        {
                            analyzer.ErrorSink.Add(Errors.NonVariablePassedByRef, analyzer.SourceUnit, node.Expression.Span);
                            analyzer.LeaveActParam();
                            return;
                        }
                    }
                    else
                    {
                        info.Access = AccessType.Read;
                        if (node.Ampersand) analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, node.Span);
                    }
                }

                node._expression = node.Expression.Analyze(analyzer, info).Literalize();

                // TODO: if signature is known, act. param has type hint and expression has known type; check if type hint matches expression

                analyzer.LeaveActParam();
            }
開發者ID:dw4dev,項目名稱:Phalanger,代碼行數:56,代碼來源:CallSignature.cs

示例2: Analyze

		internal void Analyze(Analyzer/*!*/ analyzer, bool isBaseCtorCallConstrained)
		{
			// TODO: isBaseCtorCallConstrained

			ExInfoFromParent info = new ExInfoFromParent(this);

			analyzer.EnterActParam();

			if (analyzer.ActParamDeclIsUnknown())
			{
				// we don't know whether the parameter will be passed by reference at run-time:
				if (expression.AllowsPassByReference)
				{
					info.Access = AccessType.ReadUnknown;

					// Although we prepare to pass reference, value can be really passed.
					// That's why we report warning when user use '&' in calling, 
					// because it has no influence.
					if (ampersand)
						analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, position);
				}
				else
				{
					info.Access = AccessType.Read;
				}
			}
			else
			{
				if (analyzer.ActParamPassedByRef())
				{
					if (expression.AllowsPassByReference)
					{
						info.Access = AccessType.ReadRef;
					}
					else
					{
						analyzer.ErrorSink.Add(Errors.NonVariablePassedByRef, analyzer.SourceUnit, expression.Position);
						analyzer.LeaveActParam();
						return;
					}
				}
				else
				{
					info.Access = AccessType.Read;
					if (ampersand) analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, position);
				}
			}

			expression = expression.Analyze(analyzer, info).Literalize();

			analyzer.LeaveActParam();
		}
開發者ID:Ashod,項目名稱:Phalanger,代碼行數:52,代碼來源:CallSignature.cs


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