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


C# MSA类代码示例

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


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


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