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


C# Context.ToString方法代码示例

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


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

示例1: Promote

        protected void Promote(Operand local)
        {
            var stacktype = local.Type.GetStackType();

            var v = MethodCompiler.CreateVirtualRegister(stacktype);

            if (trace.Active) trace.Log("*** Replacing: " + local.ToString() + " with " + v.ToString());

            foreach (int index in local.Uses.ToArray())
            {
                Context ctx = new Context(InstructionSet, index);

                for (int i = 0; i < ctx.OperandCount; i++)
                {
                    Operand operand = ctx.GetOperand(i);

                    if (local == operand)
                    {
                        if (trace.Active) trace.Log("BEFORE:\t" + ctx.ToString());
                        ctx.SetOperand(i, v);
                        if (trace.Active) trace.Log("AFTER: \t" + ctx.ToString());
                    }
                }
            }

            foreach (int index in local.Definitions.ToArray())
            {
                Context ctx = new Context(InstructionSet, index);

                for (int i = 0; i < ctx.OperandCount; i++)
                {
                    Operand operand = ctx.GetResult(i);

                    if (local == operand)
                    {
                        if (trace.Active) trace.Log("BEFORE:\t" + ctx.ToString());
                        ctx.SetResult(i, v);
                        if (trace.Active) trace.Log("AFTER: \t" + ctx.ToString());
                    }
                }
            }
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:42,代码来源:PromoteLocalVariablesStage.cs

示例2: CanConstructContext

        public void CanConstructContext()
        {
            client = new Context(SdkHelper.Splunk.Scheme, SdkHelper.Splunk.Host, SdkHelper.Splunk.Port);

            Assert.Equal(client.Scheme, Scheme.Https);
            Assert.Equal(client.Host.ToLower(), SdkHelper.Splunk.Host);
            Assert.Equal(client.Port, SdkHelper.Splunk.Port);
            Assert.Null(client.SessionKey);

            Assert.Equal(client.ToString().ToLower(), string.Format("https://{0}:{1}", SdkHelper.Splunk.Host.ToLower(), SdkHelper.Splunk.Port));
        }
开发者ID:Netsuye,项目名称:Splunk-SDK,代码行数:11,代码来源:TestContext.cs

示例3: Run

        protected override void Run()
        {
            if (!HasCode)
                return;

            if (HasProtectedRegions)
                return;

            finalVirtualRegisters = new Dictionary<Operand, Operand>();

            foreach (var block in BasicBlocks)
            {
                for (var context = new Context(InstructionSet, block); !context.IsBlockEndInstruction; context.GotoNext())
                {
                    if (context.IsEmpty)
                        continue;

                    instructionCount++;

                    if (context.Instruction == IRInstruction.Phi)
                    {
                        //Debug.Assert(context.OperandCount == context.BasicBlock.PreviousBlocks.Count);
                        if (context.OperandCount != context.BasicBlock.PreviousBlocks.Count)
                        {
                            throw new Mosa.Compiler.Common.InvalidCompilerException(context.ToString());
                        }

                        ProcessPhiInstruction(context);
                    }

                    for (var i = 0; i < context.OperandCount; ++i)
                    {
                        var op = context.GetOperand(i);

                        if (op != null && op.IsSSA)
                        {
                            context.SetOperand(i, GetFinalVirtualRegister(op));
                        }
                    }

                    if (context.Result != null && context.Result.IsSSA)
                    {
                        context.Result = GetFinalVirtualRegister(context.Result);
                    }
                }
            }

            finalVirtualRegisters = null;
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:49,代码来源:LeaveSSAStage.cs

示例4: MakeCall

        /// <summary>
        /// Expands method call instruction represented by the context to perform the method call.
        /// </summary>
        /// <param name="typeLayout">The type layouts.</param>
        /// <param name="context">The context.</param>
        public override void MakeCall(BaseMethodCompiler compiler, MosaTypeLayout typeLayout, Context context)
        {
            /*
             * Calling convention is right-to-left, pushed on the stack. Return value in EAX for integral
             * types 4 bytes or less, XMM0 for floating point and EAX:EDX for 64-bit. If this is a method
             * of a type, the this argument is moved to ECX right before the call.
             * If return value is value type, a stack local is allocated as a hidden parameter in caller
             * stack, the callee will then store the return value in the allocated space
             * The return value is the first parameter (even before this)
             * The callee will place the address of the return value into EAX and the caller will then
             * either retrieve the return value using compound move or will let one of the callers higher
             * in the caller chain handle the retrieval of the return value using compound move.
             */

            Operand target = context.Operand1;
            Operand result = context.Result;
            MosaMethod method = context.InvokeMethod;

            Debug.Assert(method != null, context.ToString());

            Operand scratch = Operand.CreateCPURegister(typeLayout.TypeSystem.BuiltIn.Pointer, scratchRegister);

            List<Operand> operands = BuildOperands(context);

            int stackSize = CalculateStackSizeForParameters(typeLayout, architecture, operands, method);

            context.Empty();

            int returnSize = 0;
            if (typeLayout.IsCompoundType(method.Signature.ReturnType))
            {
                returnSize = typeLayout.GetTypeSize(method.Signature.ReturnType);
            }

            if (stackSize != 0 || returnSize != 0)
            {
                ReserveStackSizeForCall(typeLayout.TypeSystem, context, returnSize + stackSize, scratch);
                PushOperands(compiler, typeLayout, context, method, operands, returnSize + stackSize, scratch);
            }

            // the mov/call two-instructions combo is to help facilitate the register allocator
            architecture.InsertMoveInstruction(context, scratch, target);
            architecture.InsertCallInstruction(context, scratch);

            CleanupReturnValue(compiler, typeLayout, context, result);
            FreeStackAfterCall(typeLayout.TypeSystem, context, returnSize + stackSize);
        }
开发者ID:pacificIT,项目名称:MOSA-Project,代码行数:52,代码来源:BaseCallingConvention32Bit.cs

示例5: NumberInstructions

        private void NumberInstructions()
        {
            var number = new CompilerTrace(trace, "InstructionNumber");

            int index = SlotIncrement;

            foreach (BasicBlock block in basicBlocks)
            {
                for (Context context = new Context(instructionSet, block); ; context.GotoNext())
                {
                    if (!context.IsEmpty)
                    {
                        context.SlotNumber = index;
                        index = index + SlotIncrement;

                        if (number.Active)
                        {
                            if (context.IsBlockStartInstruction)
                            {
                                number.Log(context.SlotNumber.ToString() + " = " + context.ToString() + " # " + block.ToString());
                            }
                            else
                            {
                                number.Log(context.SlotNumber.ToString() + " = " + context.ToString());
                            }
                        }
                    }

                    if (context.IsBlockEndInstruction)
                        break;
                }

                SlotIndex start = new SlotIndex(instructionSet, block.StartIndex);
                SlotIndex end = new SlotIndex(instructionSet, block.EndIndex);
                extendedBlocks[block.Sequence].Interval = new Interval(start, end);
            }
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:37,代码来源:GreedyRegisterAllocator.cs

示例6: ComputeLocalLiveSets

        private void ComputeLocalLiveSets()
        {
            var liveSetTrace = new CompilerTrace(trace, "ComputeLocalLiveSets");

            foreach (var block in extendedBlocks)
            {
                if (liveSetTrace.Active)
                    liveSetTrace.Log("Block # " + block.BasicBlock.Sequence.ToString());

                BitArray liveGen = new BitArray(registerCount, false);
                BitArray liveKill = new BitArray(registerCount, false);

                liveGen.Set(stackFrameRegister.Index, true);
                liveGen.Set(stackPointerRegister.Index, true);

                if (programCounter != null)
                    liveGen.Set(programCounter.Index, true);

                for (Context context = new Context(instructionSet, block.BasicBlock); !context.IsBlockEndInstruction; context.GotoNext())
                {
                    if (context.IsEmpty)
                        continue;

                    if (liveSetTrace.Active)
                        liveSetTrace.Log(context.ToString());

                    OperandVisitor visitor = new OperandVisitor(context);

                    foreach (var ops in visitor.Input)
                    {
                        if (liveSetTrace.Active)
                            liveSetTrace.Log("INPUT:  " + ops.ToString());

                        int index = GetIndex(ops);
                        if (!liveKill.Get(index))
                        {
                            liveGen.Set(index, true);

                            if (liveSetTrace.Active)
                                liveSetTrace.Log("GEN:  " + index.ToString() + " " + ops.ToString());
                        }
                    }

                    if (context.Instruction.FlowControl == FlowControl.Call)
                    {
                        for (int s = 0; s < physicalRegisterCount; s++)
                        {
                            liveKill.Set(s, true);
                        }

                        if (liveSetTrace.Active)
                            liveSetTrace.Log("KILL ALL PHYSICAL");
                    }

                    foreach (var ops in visitor.Output)
                    {
                        if (liveSetTrace.Active)
                            liveSetTrace.Log("OUTPUT: " + ops.ToString());

                        int index = GetIndex(ops);
                        liveKill.Set(index, true);

                        if (liveSetTrace.Active)
                            liveSetTrace.Log("KILL: " + index.ToString() + " " + ops.ToString());
                    }
                }

                block.LiveGen = liveGen;
                block.LiveKill = liveKill;
                block.LiveKillNot = ((BitArray)liveKill.Clone()).Not();

                if (liveSetTrace.Active)
                {
                    liveSetTrace.Log("GEN:     " + ToString(block.LiveGen));
                    liveSetTrace.Log("KILL:    " + ToString(block.LiveKill));
                    liveSetTrace.Log("KILLNOT: " + ToString(block.LiveKillNot));
                    liveSetTrace.Log(string.Empty);
                }
            }
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:80,代码来源:GreedyRegisterAllocator.cs

示例7: SimplifyExtendedMove

        /// <summary>
        /// Simplifies extended moves with a constant
        /// </summary>
        /// <param name="context">The context.</param>
        private void SimplifyExtendedMove(Context context)
        {
            if (context.IsEmpty)
                return;

            if (!(context.Instruction == IRInstruction.ZeroExtendedMove || context.Instruction == IRInstruction.SignExtendedMove))
                return;

            if (!context.Result.IsVirtualRegister)
                return;

            Operand result = context.Result;
            Operand op1 = context.Operand1;

            if (!op1.IsConstant)
                return;

            Operand newOperand;

            if (context.Instruction == IRInstruction.ZeroExtendedMove && result.IsUnsigned && op1.IsSigned)
            {
                var newConstant = Unsign(op1.Type, op1.ConstantSignedInteger);
                newOperand = Operand.CreateConstant(context.Result.Type, newConstant);
            }
            else
            {
                newOperand = Operand.CreateConstant(context.Result.Type, op1.ConstantUnsignedInteger);
            }

            AddOperandUsageToWorkList(context);
            if (trace.Active) trace.Log("*** SimplifyExtendedMove");
            if (trace.Active) trace.Log("BEFORE:\t" + context.ToString());
            context.SetInstruction(IRInstruction.Move, result, newOperand);
            simplifyExtendedMoveCount++;
            if (trace.Active) trace.Log("AFTER: \t" + context.ToString());
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:40,代码来源:SSAOptimizations.cs

示例8: StrengthReductionLogicalOperators

        /// <summary>
        /// Strength reduction for logical operators
        /// </summary>
        /// <param name="context">The context.</param>
        private void StrengthReductionLogicalOperators(Context context)
        {
            if (context.IsEmpty)
                return;

            if (!(context.Instruction == IRInstruction.LogicalAnd || context.Instruction == IRInstruction.LogicalOr))
                return;

            if (!context.Result.IsVirtualRegister)
                return;

            Operand result = context.Result;
            Operand op1 = context.Operand1;
            Operand op2 = context.Operand2;

            if (context.Instruction == IRInstruction.LogicalOr && op1.IsConstant && !op2.IsConstant && op1.IsConstantZero)
            {
                AddOperandUsageToWorkList(context);
                if (trace.Active) trace.Log("*** StrengthReductionLogicalOperators");
                if (trace.Active) trace.Log("BEFORE:\t" + context.ToString());
                context.SetInstruction(IRInstruction.Move, result, Operand.CreateConstant(context.Result.Type, op2.ConstantSignedInteger));
                strengthReductionLogicalOperatorsCount++;
                if (trace.Active) trace.Log("AFTER: \t" + context.ToString());
            }

            if (context.Instruction == IRInstruction.LogicalOr && op2.IsConstant && !op1.IsConstant && op2.IsConstantZero)
            {
                AddOperandUsageToWorkList(context);
                if (trace.Active) trace.Log("*** StrengthReductionLogicalOperators");
                if (trace.Active) trace.Log("BEFORE:\t" + context.ToString());
                context.SetInstruction(IRInstruction.Move, result, Operand.CreateConstant(context.Result.Type, op1.ConstantSignedInteger));
                strengthReductionLogicalOperatorsCount++;
                if (trace.Active) trace.Log("AFTER: \t" + context.ToString());
            }

            if (context.Instruction == IRInstruction.LogicalAnd && op1.IsConstant && !op1.IsConstant && op1.IsConstantZero)
            {
                AddOperandUsageToWorkList(context);
                if (trace.Active) trace.Log("*** StrengthReductionLogicalOperators");
                if (trace.Active) trace.Log("BEFORE:\t" + context.ToString());
                context.SetInstruction(IRInstruction.Move, result, Operand.CreateConstant(context.Result.Type, 0));
                strengthReductionLogicalOperatorsCount++;
                if (trace.Active) trace.Log("AFTER: \t" + context.ToString());
            }

            if (context.Instruction == IRInstruction.LogicalAnd && op2.IsConstant && !op1.IsConstant && op2.IsConstantZero)
            {
                AddOperandUsageToWorkList(context);
                if (trace.Active) trace.Log("*** StrengthReductionLogicalOperators");
                if (trace.Active) trace.Log("BEFORE:\t" + context.ToString());
                context.SetInstruction(IRInstruction.Move, result, Operand.CreateConstant(context.Result.Type, 0));
                strengthReductionLogicalOperatorsCount++;
                if (trace.Active) trace.Log("AFTER: \t" + context.ToString());
            }

            // TODO: Add more strength reductions especially for AND w/ 0xFF, 0xFFFF, 0xFFFFFFFF, etc when source or destination are same or smaller
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:61,代码来源:SSAOptimizations.cs

示例9: SimplifyExtendedMove

        /// <summary>
        /// Simplifies an extended moves on a constant
        /// </summary>
        /// <param name="context">The context.</param>
        private void SimplifyExtendedMove(Context context)
        {
            if (context.IsEmpty)
                return;

            if (!(context.Instruction is IR.ZeroExtendedMove || context.Instruction is IR.SignExtendedMove))
                return;

            Operand result = context.Result;
            Operand op1 = context.Operand1;

            if (!op1.IsConstant)
                return;

            AddOperandUsageToWorkList(context);
            if (IsLogging) Trace("BEFORE:\t" + context.ToString());
            context.SetInstruction(IR.IRInstruction.Move, result, Operand.CreateConstant(context.Result.Type, op1.Value));
            if (IsLogging) Trace("AFTER: \t" + context.ToString());
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:23,代码来源:SSAOptimizations.cs

示例10: SimpleConstantPropagation

        /// <summary>
        /// Simple constant propagation.
        /// </summary>
        /// <param name="context">The context.</param>
        private void SimpleConstantPropagation(Context context)
        {
            if (context.IsEmpty)
                return;

            if (!(context.Instruction is IR.Move))
                return;

            if (!context.Operand1.IsConstant)
                return;

            Operand destinationOperand = context.Result;
            Operand sourceOperand = context.Operand1;

            // for each statement T that uses operand, substituted c in statement T
            foreach (int index in destinationOperand.Uses.ToArray())
            {
                Context ctx = new Context(instructionSet, index);

                if (ctx.Instruction is IR.AddressOf || ctx.Instruction is IR.Phi)
                    continue;

                bool propogated = false;

                for (int i = 0; i < ctx.OperandCount; i++)
                {
                    Operand operand = ctx.GetOperand(i);

                    if (operand == context.Result)
                    {
                        propogated = true;

                        if (IsLogging) Trace("BEFORE:\t" + ctx.ToString());
                        AddOperandUsageToWorkList(operand);
                        ctx.SetOperand(i, sourceOperand);
                        if (IsLogging) Trace("AFTER: \t" + ctx.ToString());
                    }
                }

                if (propogated)
                    AddToWorkList(index);
            }
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:47,代码来源:SSAOptimizations.cs

示例11: DeadCodeElimination

        /// <summary>
        /// Removes the useless move and dead code
        /// </summary>
        /// <param name="context">The context.</param>
        private void DeadCodeElimination(Context context)
        {
            if (context.IsEmpty)
                return;

            if (context.ResultCount != 1)
                return;

            if (context.Instruction is IR.Move && context.Operand1 == context.Result)
            {
                if (IsLogging) Trace("REMOVED:\t" + context.ToString());
                AddOperandUsageToWorkList(context);
                context.SetInstruction(IRInstruction.Nop);
                instructionsRemoved++;
                //context.Remove();
                return;
            }

            if (context.Result.Uses.Count != 0 || context.Instruction is IR.Call || context.Instruction is IR.IntrinsicMethodCall)
                return;

            if (!context.Result.IsStackLocal)
                return;

            if (IsLogging) Trace("REMOVED:\t" + context.ToString());
            AddOperandUsageToWorkList(context);
            context.SetInstruction(IRInstruction.Nop);
            instructionsRemoved++;
            //context.Remove();
            return;
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:35,代码来源:SSAOptimizations.cs

示例12: EmitInstructions

        /// <summary>
        /// Called to emit a list of instructions offered by the instruction provider.
        /// </summary>
        protected virtual void EmitInstructions()
        {
            foreach (BasicBlock block in basicBlocks)
            {
                BlockStart(block);

                for (Context context = new Context(instructionSet, block); !context.EndOfInstruction; context.GotoNext())
                {
                    if (!context.IsEmpty)
                    {
                        BasePlatformInstruction instruction = context.Instruction as BasePlatformInstruction;
                        if (instruction != null)
                            instruction.Emit(context, codeEmitter);
                        else
                            if (architecture.PlatformName != "Null")
                                Trace(InternalTrace.CompilerEvent.Error, "Missing Code Transformation: " + context.ToString());
                    }
                }

                BlockEnd(block);
            }
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:25,代码来源:CodeGenerationStage.cs

示例13: GetColumn

    public string GetColumn(string path, Project project)
    {
        if (string.IsNullOrEmpty(path)) {
            return ToString();
        }

        string[] parts = path.Split(new char[] { '.' }, 2);

        if (parts[0].StartsWith("!")) {
            string mark = parts[0].Substring(1);
            if (Marks.ContainsKey(mark)) {
                return Marks[mark];
            }
        }
        else if (parts[0].StartsWith("*")) {
            Rule r = project.Rules.GetRuleByName(parts[0].Substring(1));

            Context c = new Context();
            c._Tokens = new List<string>(this.Tokens);
            r.Execute(c);

            if (parts.Length > 1) {
                return c.GetColumn(parts[1], project);
            }
            else {
                return c.ToString();
            }
        }
        else if (Branches.ContainsKey(parts[0])) {
            if (parts.Length > 1) {
                return Branches[parts[0]].GetColumn(parts[1], project);
            }
            else {
                return Branches[parts[0]].ToString();
            }
        }

        return "N/A";
    }
开发者ID:alfar,项目名称:WordBuilder,代码行数:39,代码来源:Context.cs

示例14: SaveZippedPatch

        private static void SaveZippedPatch( string path, Context destinationContext )
        {
            using ( ZipOutputStream stream = new ZipOutputStream( File.Open( path, FileMode.Create, FileAccess.ReadWrite ) ) )
            {
                const string fileVersion = "1.0";
                bool psp = destinationContext == Context.US_PSP;

                WriteFileToZip( stream, "version", Encoding.UTF8.GetBytes( fileVersion ) );
                WriteFileToZip( stream, "type", Encoding.UTF8.GetBytes( destinationContext.ToString() ) );

                WriteFileToZip( stream, elementNames[ElementName.Abilities], Abilities.ToByteArray( destinationContext ) );
                WriteFileToZip( stream, elementNames[ElementName.AbilityEffects], Abilities.ToEffectsByteArray() );
                WriteFileToZip( stream, elementNames[ElementName.Items], Items.ToFirstByteArray() );
                WriteFileToZip( stream, elementNames[ElementName.ItemAttributes], ItemAttributes.ToFirstByteArray() );
                if ( psp && Context == Context.US_PSP )
                {
                    WriteFileToZip( stream, elementNames[ElementName.PSPItems], Items.ToSecondByteArray() );
                    WriteFileToZip( stream, elementNames[ElementName.PSPItemAttributes], ItemAttributes.ToSecondByteArray() );
                    WriteFileToZip( stream, elementNames[ElementName.ENTD5], ENTDs.PSPEventsToByteArray() );
                }
                WriteFileToZip( stream, elementNames[ElementName.Jobs], Jobs.ToByteArray( destinationContext ) );
                WriteFileToZip( stream, elementNames[ElementName.JobLevels], JobLevels.ToByteArray( destinationContext ) );
                WriteFileToZip( stream, elementNames[ElementName.MonsterSkills], MonsterSkills.ToByteArray( destinationContext ) );
                WriteFileToZip( stream, elementNames[ElementName.SkillSets], SkillSets.ToByteArray( destinationContext ) );
                WriteFileToZip( stream, elementNames[ElementName.ActionMenus], ActionMenus.ToByteArray( destinationContext ) );
                WriteFileToZip( stream, elementNames[ElementName.StatusAttributes], StatusAttributes.ToByteArray( destinationContext ) );
                WriteFileToZip( stream, elementNames[ElementName.InflictStatuses], InflictStatuses.ToByteArray() );
                WriteFileToZip( stream, elementNames[ElementName.Poaching], PoachProbabilities.ToByteArray( destinationContext ) );
                WriteFileToZip( stream, elementNames[ElementName.ENTD1], ENTDs.ENTDs[0].ToByteArray() );
                WriteFileToZip( stream, elementNames[ElementName.ENTD2], ENTDs.ENTDs[1].ToByteArray() );
                WriteFileToZip( stream, elementNames[ElementName.ENTD3], ENTDs.ENTDs[2].ToByteArray() );
                WriteFileToZip( stream, elementNames[ElementName.ENTD4], ENTDs.ENTDs[3].ToByteArray() );
                WriteFileToZip( stream, elementNames[ElementName.MoveFindItems], MoveFind.ToByteArray() );
                WriteFileToZip( stream, elementNames[ElementName.StoreInventories], StoreInventories.ToByteArray() );
            }
        }
开发者ID:Wi150nZ,项目名称:lioneditor,代码行数:36,代码来源:FFTPatch.cs

示例15: ToCSS

        protected virtual string ToCSS(Context context)
        {
            var css = new List<string>();                   // The CSS output
              var rules = new List<string>();                 // node.Rule instances
              var rulesets = new List<string>();              // node.Ruleset instances
              var paths = new Context();                      // Current selectors

              if (!Root)
              {
            paths.AppendSelectors(context, Selectors);
              }

              // Evaluate rules and rulesets
              foreach (var rule in Rules)
              {
            if (rule is Ruleset)
            {
              var ruleset = (Ruleset) rule;
              rulesets.Add(ruleset.ToCSS(paths));
            }
            else if (rule is Rule)
            {
              var r = (rule as Rule);

              if (!r.Variable)
            rules.Add(r.ToCSS());
            }
            else if (!rule.IgnoreOutput())
            {
              if (Root)
            rulesets.Add(rule.ToCSS());
              else
            rules.Add(rule.ToCSS());
            }
              }

              var rulesetsStr = rulesets.JoinStrings("");

              // If this is the root node, we don't render
              // a selector, or {}.
              // Otherwise, only output if this ruleset has rules.
              if (Root)
            css.Add(rules.JoinStrings("\n"));
              else
              {
            if (rules.Count > 0)
            {
              css.Add(paths.ToString());

              css.Add(" {\n  " + rules.JoinStrings("\n  ") + "\n}\n");
            }
              }
              css.Add(rulesetsStr);

              return css.JoinStrings("");
        }
开发者ID:JasonCline,项目名称:dotless,代码行数:56,代码来源:Ruleset.cs


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