• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MSA类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MSA的典型用法代码示例。如果您正苦于以下问题:C# MSA类的具体用法?C# MSA怎么用?C# MSA使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MSA类属于命名空间,在下文中一共展示了MSA类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TransformConcatentation

        internal static MSA.Expression/*!*/ TransformConcatentation(AstGenerator/*!*/ gen, List<Expression>/*!*/ parts, 
            Func<string, MethodInfo>/*!*/ opFactory, MSA.Expression additionalArg) {

            var opSuffix = new StringBuilder(Math.Min(parts.Count, 4));

            List<MSA.Expression> merged = ConcatLiteralsAndTransform(gen, parts, opSuffix);

            if (merged.Count <= RubyOps.MakeStringParamCount) {
                if (merged.Count == 0) {
                    merged.Add(Ast.Constant(String.Empty));
                    opSuffix.Append(RubyOps.SuffixBinary);
                }

                if (opSuffix.IndexOf(RubyOps.SuffixEncoded) != -1) {
                    merged.Add(Ast.Constant(RubyEncoding.GetCodePage(gen.Encoding)));
                }

                if (additionalArg != null) {
                    merged.Add(additionalArg);
                }

                return opFactory(opSuffix.ToString()).OpCall(merged);
            } else {
                var paramArray = Ast.NewArrayInit(typeof(object), merged);
                var codePage = Ast.Constant(RubyEncoding.GetCodePage(gen.Encoding));
                
                return (additionalArg != null) ?
                    opFactory("N").OpCall(paramArray, codePage, additionalArg) :
                    opFactory("N").OpCall(paramArray, codePage);
            } 
        }
开发者ID:joshholmes,项目名称:ironruby,代码行数:31,代码来源:StringConstructor.cs


示例2: TransformRead

        // arguments: complex arguments (expressions, maplets, splat, block) 
        // singleArgument: siple argument (complex are not used)
        // assignmentRhsArgument: rhs of the assignment: target.method=(rhs)
        internal static MSA.Expression/*!*/ TransformRead(Expression/*!*/ node, AstGenerator/*!*/ gen, bool hasImplicitSelf, 
            string/*!*/ methodName, MSA.Expression/*!*/ transformedTarget,
            Arguments arguments, Block block, MSA.Expression singleArgument, MSA.Expression assignmentRhsArgument) {

            Debug.Assert(assignmentRhsArgument == null || block == null, "Block not allowed in assignment");
            Debug.Assert(singleArgument == null || arguments == null && assignmentRhsArgument == null);
            Assert.NotNull(gen, transformedTarget);
            Assert.NotEmpty(methodName);

            // Pass args in this order:
            // 1. instance
            // 2. block (if present)
            // 3. passed args: normal args, maplets, array
            // 4. RHS of assignment (if present)

            CallBuilder callBuilder = new CallBuilder(gen);
            callBuilder.Instance = transformedTarget;
            
            MSA.Expression blockArgVariable = null;
            MSA.Expression transformedBlock = null;

            if (block != null) {
                blockArgVariable = gen.CurrentScope.DefineHiddenVariable("#block-def", typeof(Proc));
                transformedBlock = block.Transform(gen);
                callBuilder.Block = blockArgVariable;
            }

            if (arguments != null) {
                arguments.TransformToCall(gen, callBuilder);
            } else if (singleArgument != null) {
                callBuilder.Add(singleArgument);
            }

            MSA.Expression rhsVariable = null;
            if (assignmentRhsArgument != null) {
                rhsVariable = gen.CurrentScope.DefineHiddenVariable("#rhs", assignmentRhsArgument.Type);
                callBuilder.RhsArgument = Ast.Assign(rhsVariable, assignmentRhsArgument);
            }

            var dynamicSite = callBuilder.MakeCallAction(methodName, hasImplicitSelf);
            if (gen.Context.CallSiteCreated != null) {
                gen.Context.CallSiteCreated(node, dynamicSite);
            }

            MSA.Expression result = gen.DebugMark(dynamicSite, methodName);

            if (block != null) {
                result = gen.DebugMark(MakeCallWithBlockRetryable(gen, result, blockArgVariable, transformedBlock, block.IsDefinition),
                    "#RB: method call with a block ('" + methodName + "')");
            }

            if (assignmentRhsArgument != null) {
                result = AstFactory.Block(result, rhsVariable);
            }

            return result;
        }
开发者ID:Hank923,项目名称:ironruby,代码行数:60,代码来源:MethodCall.cs


示例3: TransformRead

        internal static MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen, MSA.Expression/*!*/ left, MSA.Expression/*!*/ right) {
            MSA.ParameterExpression temp;

            MSA.Expression result = AstUtils.CoalesceFalse(
                AstFactory.Box(left),
                AstFactory.Box(right),
                Methods.IsTrue,
                out temp
            );

            gen.CurrentScope.AddHidden(temp);
            return result;
        }
开发者ID:aceptra,项目名称:ironruby,代码行数:13,代码来源:OrExpression.cs


示例4: ScopeBuilder

        public ScopeBuilder(MSA.ParameterExpression/*!*/[] parameters, int firstClosureParam, int localCount, 
            ScopeBuilder parent, LexicalScope/*!*/ lexicalScope) {
            Debug.Assert(parent == null || parent.LexicalScope == lexicalScope.OuterScope);
#if DEBUG
            _id = Interlocked.Increment(ref _Id);
#endif
            _parent = parent;
            _parameters = parameters;
            _localCount = localCount;
            _firstClosureParam = firstClosureParam;
            _lexicalScope = lexicalScope;
            _hiddenVariables = new ReadOnlyCollectionBuilder<MSA.ParameterExpression>();
            _localsTuple = DefineHiddenVariable("#locals", MakeLocalsTupleType());
            _outermostClosureReferredTo = this;
        }
开发者ID:aceptra,项目名称:ironruby,代码行数:15,代码来源:ScopeBuilder.cs


示例5: TransformQualifier

        internal StaticScopeKind TransformQualifier(AstGenerator/*!*/ gen, out MSA.Expression transformedQualifier) {
            if (_qualifier != null) {
                Debug.Assert(_explicitlyBound);

                // qualifier.Foo
                transformedQualifier = _qualifier.TransformRead(gen);
                return StaticScopeKind.Explicit;
            } else if (_explicitlyBound) {
                // ::Foo
                transformedQualifier = null;
                return StaticScopeKind.Global;
            } else if (gen.CurrentModule != null) {
                // statically (lexically) implicitly bound to the enclosing module:
                transformedQualifier = gen.CurrentModule.SelfVariable; // TODO: remove, should be retrieved from code context/scope
                return StaticScopeKind.EnclosingModule;
            } else {
                // statically (lexically) implicitly bound to top declaring module:
                transformedQualifier = null;
                return StaticScopeKind.EnclosingModule;
            }
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:21,代码来源:ConstantVariable.cs


示例6: EnterSourceUnit

        public void EnterSourceUnit(
            ScopeBuilder/*!*/ locals,
            MSA.Expression/*!*/ selfParameter,
            MSA.Expression/*!*/ runtimeScopeVariable,
            MSA.Expression blockParameter,
            MSA.Expression/*!*/ rfcVariable,
            MSA.Expression currentMethodVariable,
            string methodName,
            Parameters parameters) {
            Assert.NotNull(locals, selfParameter, runtimeScopeVariable, rfcVariable);

            Debug.Assert(_currentElement == null && _currentLoop == null && _currentRescue == null &&
                _currentVariableScope == null && _currentModule == null && _currentBlock == null && _currentMethod == null);

            EnterMethodDefinition(
                locals,
                selfParameter,
                runtimeScopeVariable,
                blockParameter,
                rfcVariable,
                currentMethodVariable,
                methodName,
                parameters);
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:24,代码来源:AstGenerator.cs


示例7: EnterModuleDefinition

        public void EnterModuleDefinition(
            ScopeBuilder/*!*/ locals,
            MSA.Expression/*!*/ selfVariable, 
            MSA.Expression/*!*/ runtimeScopeVariable, 
            bool isSingleton) {
            Assert.NotNull(locals, selfVariable, runtimeScopeVariable);

            ModuleScope module = new ModuleScope(locals, selfVariable, runtimeScopeVariable, isSingleton);

            module.Parent = _currentElement;
            module.ParentVariableScope = _currentVariableScope;
            module.ParentModule = _currentModule;

            _currentElement = module;
            _currentVariableScope = module;
            _currentModule = module;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:17,代码来源:AstGenerator.cs


示例8: EnterMethodDefinition

        public void EnterMethodDefinition(
            ScopeBuilder/*!*/ locals, 
            MSA.Expression/*!*/ selfParameter,
            MSA.Expression/*!*/ runtimeScopeVariable,
            MSA.Expression blockParameter,
            MSA.Expression/*!*/ rfcVariable,
            MSA.Expression currentMethodVariable,
            string/*!*/ methodName,
            Parameters parameters) {
            Assert.NotNull(locals, selfParameter, runtimeScopeVariable, rfcVariable);

            MethodScope method = new MethodScope(
                locals,
                selfParameter, 
                runtimeScopeVariable, 
                blockParameter, 
                rfcVariable,
                currentMethodVariable, 
                methodName, 
                parameters
            );

            method.Parent = _currentElement;
            method.ParentRescue = _currentRescue;
            method.ParentLoop = _currentLoop;
            method.ParentBlock = _currentBlock;
            method.ParentVariableScope = _currentVariableScope;
            method.ParentMethod = _currentMethod;

            _currentElement = method;
            _currentRescue = null;
            _currentLoop = null;
            _currentBlock = null;
            _currentVariableScope = method;
            _currentMethod = method;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:36,代码来源:AstGenerator.cs


示例9: TransformRead

        internal static MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen, List<MSA.Expression>/*!*/ rightValues, 
            MSA.Expression splattedValue, bool doSplat) {

            Assert.NotNull(gen, rightValues);

            MSA.Expression result;

            // We need to distinguish various special cases here.
            // For parallel assignment specification, see "Ruby Language.docx/Runtime/Parallel Assignment".
            
            // R(0,*)?
            bool rightNoneSplat = rightValues.Count == 0 && splattedValue != null;

            // R(1,-)?
            bool rightOneNone = rightValues.Count == 1 && splattedValue == null;

            if (rightNoneSplat) {
                result = (doSplat ? Methods.Splat : Methods.Unsplat).OpCall(AstFactory.Box(splattedValue));
            } else if (rightOneNone && doSplat) {
                result = rightValues[0];
            } else {
                result = Methods.MakeArrayOpCall(rightValues);

                if (splattedValue != null) {
                    result = Methods.SplatAppend.OpCall(result, AstFactory.Box(splattedValue));
                }
            }
            return result;
        }
开发者ID:joshholmes,项目名称:ironruby,代码行数:29,代码来源:Arguments.cs


示例10: TraceCallSite

 internal virtual void TraceCallSite(Expression/*!*/ expression, MSA.DynamicExpression/*!*/ callSite) {
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:2,代码来源:AstGenerator.cs


示例11: AddDebugInfo

 internal MSA.Expression/*!*/ AddDebugInfo(MSA.Expression/*!*/ expression, SourceSpan location) {
     return Microsoft.Scripting.Ast.Utils.AddDebugInfo(expression, _document, location.Start, location.End);
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:AstGenerator.cs


示例12: AddReturnTarget

 internal MSA.Expression/*!*/ AddReturnTarget(MSA.Expression/*!*/ expression) {
     return CurrentFrame.AddReturnTarget(expression);
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:AstGenerator.cs


示例13: MethodScope

            public MethodScope(
                ScopeBuilder/*!*/ builder, 
                MSA.Expression/*!*/ selfVariable, 
                MSA.Expression/*!*/ runtimeScopeVariable,
                MSA.Expression blockVariable, 
                MSA.Expression/*!*/ rfcVariable,
                MSA.Expression currentMethodVariable, 
                string methodName, 
                Parameters parameters)
                : base(builder, selfVariable, runtimeScopeVariable) {

                Assert.NotNull(rfcVariable);
                _blockVariable = blockVariable;
                _rfcVariable = rfcVariable;
                _methodName = methodName;
                _parameters = parameters;
                _currentMethodVariable = currentMethodVariable;
            }
开发者ID:jcteague,项目名称:ironruby,代码行数:18,代码来源:AstGenerator.cs


示例14: BlockScope

 public BlockScope(ScopeBuilder/*!*/ builder, MSA.Expression/*!*/ selfVariable, MSA.Expression/*!*/ runtimeScopeVariable,
     MSA.Expression/*!*/ bfcVariable, MSA.LabelTarget/*!*/ redoLabel)
     : base(builder, selfVariable, runtimeScopeVariable) {
     Assert.NotNull(bfcVariable, redoLabel);
     _bfcVariable = bfcVariable;
     _redoLabel = redoLabel;
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:7,代码来源:AstGenerator.cs


示例15: FrameScope

 public FrameScope(ScopeBuilder/*!*/ builder, MSA.Expression/*!*/ selfVariable, MSA.Expression/*!*/ runtimeScopeVariable)
     : base(builder, selfVariable, runtimeScopeVariable) {
     _uniqueId = Interlocked.Increment(ref _UniqueId);
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:4,代码来源:AstGenerator.cs


示例16: VariableScope

 public VariableScope(ScopeBuilder/*!*/ locals, MSA.Expression/*!*/ selfVariable, MSA.Expression/*!*/ runtimeScopeVariable) {
     Assert.NotNull(selfVariable, runtimeScopeVariable);
     _builder = locals;
     _runtimeScopeVariable = runtimeScopeVariable;
     _selfVariable = selfVariable;
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:6,代码来源:AstGenerator.cs


示例17: RescueScope

 public RescueScope(MSA.Expression/*!*/ retryingVariable, MSA.LabelTarget/*!*/ breakLabel, MSA.LabelTarget/*!*/ continueLabel) {
     Assert.NotNull(retryingVariable, breakLabel, continueLabel);
     _retryingVariable = retryingVariable;
     _breakLabel = breakLabel;
     _continueLabel = continueLabel;
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:6,代码来源:AstGenerator.cs


示例18: LoopScope

 public LoopScope(MSA.Expression/*!*/ redoVariable, MSA.Expression/*!*/ resultVariable, MSA.LabelTarget/*!*/ breakLabel, MSA.LabelTarget/*!*/ continueLabel) {
     Assert.NotNull(redoVariable, resultVariable, breakLabel, continueLabel);
     _redoVariable = redoVariable;
     _resultVariable = resultVariable;
     _breakLabel = breakLabel;
     _continueLabel = continueLabel;
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:7,代码来源:AstGenerator.cs


示例19: TransformStatements

 internal MSA.Expression/*!*/ TransformStatements(MSA.Expression prologue, Statements/*!*/ statements, ResultOperation resultOperation) {
     return TransformStatements(prologue, statements, null, resultOperation);
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:AstGenerator.cs


示例20: ModuleScope

 public ModuleScope(ScopeBuilder/*!*/ builder, MSA.Expression/*!*/ selfVariable, MSA.Expression/*!*/ runtimeScopeVariable, bool isSingleton)
     : base(builder, selfVariable, runtimeScopeVariable) {
     _isSingleton = isSingleton;
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:4,代码来源:AstGenerator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MSBuildLogsExtended类代码示例发布时间:2022-05-24
下一篇:
C# MPSettings类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap