コード例 #1
0
 public override void PropagateChanges(MethodInvocationExpression eval, List chain)
 {
     ExpressionCollection expressions = new ExpressionCollection();
     foreach (object local1 in chain.Reversed)
     {
         if (!(local1 is ProcessAssignmentsToSpecialMembers.ChainItem))
         {
         }
         ProcessAssignmentsToSpecialMembers.ChainItem item = (ProcessAssignmentsToSpecialMembers.ChainItem) RuntimeServices.Coerce(local1, typeof(ProcessAssignmentsToSpecialMembers.ChainItem));
         if (item.Container is MethodInvocationExpression)
         {
             break;
         }
         if (item.Container is SlicingExpression)
         {
             SlicingExpression expression = item.Container;
             Expression[] expressionArray1 = new Expression[] { expression.get_Target().CloneNode(), expression.get_Indices().get_Item(0).get_Begin().CloneNode(), this.get_CodeBuilder().CreateReference(item.Local) };
             expressions.Add(this.CreateConstructorInvocation(this._sliceValueTypeChangeConstructor, expressionArray1));
             break;
         }
         MemberReferenceExpression container = item.Container;
         Expression[] args = new Expression[] { container.get_Target().CloneNode(), this.get_CodeBuilder().CreateStringLiteral(container.get_Name()), this.get_CodeBuilder().CreateReference(item.Local) };
         expressions.Add(this.CreateConstructorInvocation(this._valueTypeChangeConstructor, args));
     }
     MethodInvocationExpression expression3 = this.get_CodeBuilder().CreateMethodInvocation(this._propagateChanges);
     IArrayType type = this._valueTypeChangeType.MakeArrayType(1);
     expression3.get_Arguments().Add(this.get_CodeBuilder().CreateArray(type, expressions));
     eval.get_Arguments().Add(expression3);
 }
コード例 #2
0
        private void BlockTag(string tag, IDictionary attributes, ICallable block)
        {
            Output.Write("<{0}", tag);

            List<string> attributeValues = new List<string>();

            if (null != attributes)
            {
                foreach (DictionaryEntry entry in attributes)
                {
                    attributeValues.Add(string.Format("{0}=\"{1}\"", entry.Key, entry.Value));
                }
            }

            if (0 != attributeValues.Count)
            {
                Output.Write(" ");
                Output.Write(string.Join(" ", attributeValues.ToArray()));
            }

            Output.Write(">");
            if(block!=null)
            {
                block.Call(null);
            }
            Output.Write("</{0}>", tag);
        }
コード例 #3
0
        public void CurrentStep()
        {
            var pipeline = new CompilerPipeline();

            var step1 = new ActionStep(delegate {});

            pipeline.Add(step1);

            ActionStep step2 = null;

            step2 = new ActionStep(() => Assert.AreSame(step2, pipeline.CurrentStep));
            pipeline.Add(step2);

            var currentSteps = new Boo.Lang.List();

            pipeline.Before     += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
            pipeline.BeforeStep += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
            pipeline.AfterStep  += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
            pipeline.After      += (sender, args) => currentSteps.Add(pipeline.CurrentStep);

            pipeline.Run(new CompilerContext());

            Assert.AreEqual(
                new object[] { null, step1, step1, step2, step2, null },
                currentSteps.ToArray());
        }
コード例 #4
0
    public static string CreateUXMLTemplate(string folder)
    {
        UxmlSchemaGenerator.UpdateSchemaFiles();

        string[] pathComponents         = folder.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
        Boo.Lang.List <string> backDots = new Boo.Lang.List <string>();
        foreach (var s in pathComponents)
        {
            if (s == ".")
            {
                continue;
            }
            if (s == ".." && backDots.Count > 0)
            {
                backDots.RemoveAt(backDots.Count - 1);
            }
            else
            {
                backDots.Add("..");
            }
        }
        backDots.Add(UxmlSchemaGenerator.k_SchemaFolder);
        string schemaDirectory = string.Join("/", backDots.ToArray());

        string xmlnsList          = String.Empty;
        string schemaLocationList = String.Empty;
        Dictionary <string, string> namespacePrefix = UxmlSchemaGenerator.GetNamespacePrefixDictionary();

        foreach (var prefix in namespacePrefix)
        {
            if (prefix.Key == String.Empty)
            {
                continue;
            }

            if (prefix.Value != String.Empty)
            {
                xmlnsList += "    xmlns:" + prefix.Value + "=\"" + prefix.Key + "\"\n";
            }
            schemaLocationList += "                        " + prefix.Key + " " + schemaDirectory + "/" +
                                  UxmlSchemaGenerator.GetFileNameForNamespace(prefix.Key) + "\n";
        }

        // The noNamespaceSchemaLocation attribute should be sufficient to reference all namespaces
        // but Rider does not support it very well, so we add schemaLocation to make it happy.
        string uxmlTemplate = String.Format(@"<?xml version=""1.0"" encoding=""utf-8""?>
<engine:{0}
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
{1}
xsi:noNamespaceSchemaLocation=""{2}/UIElements.xsd""
xsi:schemaLocation=""
{3}""
>
    <engine:Label text=""Hello World! From UXML"" />
</engine:{0}>", UXMLImporterImpl.k_RootNode, xmlnsList, schemaDirectory, schemaLocationList);

        return(uxmlTemplate);
    }
コード例 #5
0
 public EvaluationContext()
 {
     if (!this.$initialized__UnityScript_Scripting_EvaluationContext$)
     {
         this._activeScripts = new List();
         this.$initialized__UnityScript_Scripting_EvaluationContext$ = true;
     }
     this._container = new SimpleEvaluationDomainProvider();
 }
コード例 #6
0
ファイル: CompilerPipelineTest.cs プロジェクト: 0xb1dd1e/boo
		public void CurrentStep()
		{
			var pipeline = new CompilerPipeline();

			var step1 = new ActionStep(delegate {});
			pipeline.Add(step1);

			ActionStep step2 = null;
			step2 = new ActionStep(() => Assert.AreSame(step2, pipeline.CurrentStep));
			pipeline.Add(step2);

			var currentSteps = new Boo.Lang.List();
			pipeline.Before += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.BeforeStep += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.AfterStep += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.After += (sender, args) => currentSteps.Add(pipeline.CurrentStep);

			pipeline.Run(new CompilerContext());

			Assert.AreEqual(
				new object[] { null, step1, step1, step2, step2, null },
				currentSteps.ToArray());
		}
コード例 #7
0
        protected override void CustomizeCompiler(Boo.Lang.Compiler.BooCompiler compiler, Boo.Lang.Compiler.CompilerPipeline pipeline, string[] urls)
        {
            compiler.Parameters.Ducky = true;
            List<Assembly> asmss = new List<Assembly>();
            if (ReferAllLoadedAssemblies)
            {
                asmss.AddRange(AppDomain.CurrentDomain.GetAssemblies());
            }
            if (ReferencedAssemblies != null) asmss.AddRange(ReferencedAssemblies);

            foreach (Assembly asm in asmss)
            {
                try
                {
                    string loc = asm.Location;
                    if (!compiler.Parameters.References.Contains(asm)) compiler.Parameters.References.Add(asm);
                }
                catch (Exception) { log.Debug("Error adding assembly dependency: {0}", asm.FullName); }
            }

            pipeline.Insert(1, new ImplicitBaseClassCompilerStep(
                typeof(MessageHandlerBase), "Prepare", _namespaces));
            //pipeline.Insert(2, new AutoReferenceFilesCompilerStep());
        }
コード例 #8
0
    private void OnClickRemoveNode(Node node)
    {
        if (_connections != null)
        {
            Boo.Lang.List <Connection> connectionsToRemove = new Boo.Lang.List <Connection>();

            for (int i = 0; i < _connections.Count; i++)
            {
                if (_connections[i].inPoint == node.inPoint || _connections[i].outPoint == node.outPoint)
                {
                    connectionsToRemove.Add(_connections[i]);
                }
            }

            for (int i = 0; i < connectionsToRemove.Count; i++)
            {
                _connections.Remove(connectionsToRemove[i]);
            }

            connectionsToRemove = null;
        }

        _nodes.Remove(node);
    }
コード例 #9
0
 public ForeignReferenceCollector()
 {
     _references = new List();
     _recursiveReferences = new List();
     _referencedEntities = new Hash();
 }
コード例 #10
0
 public void Index8()
 {
     object[] objArray1 = new object[] { 1, 2 };
     List list1 = new List(objArray1, true);
     this.PropertyBag.Add("items", list1);
 }
コード例 #11
0
 public override List WalkMemberChain(MemberReferenceExpression memberRef)
 {
     List list = new List();
     while (true)
     {
         MemberReferenceExpression node = memberRef.get_Target() as MemberReferenceExpression;
         if ((node == null) || (this.IsSpecialMemberTarget(node) && this.IsReadOnlyMember(node)))
         {
             this.get_Warnings().Add(CompilerWarningFactory.AssignmentToTemporary(memberRef));
             return null;
         }
         if (this.IsSpecialMemberTarget(node) && !this.IsFieldReference(node))
         {
             list.Insert(0, new ProcessAssignmentsToSpecialMembers.ChainItem(node));
         }
         if ((node.get_Target() is MethodInvocationExpression) || (node.get_Target() is SlicingExpression))
         {
             list.Insert(0, new ProcessAssignmentsToSpecialMembers.ChainItem(node.get_Target()));
             return list;
         }
         if (this.IsTerminalReferenceNode(node.get_Target()))
         {
             return list;
         }
         memberRef = node;
     }
 }
コード例 #12
0
ファイル: List.cs プロジェクト: w4x/boolangstudio
 public ListEnumerator(List list)
 {
     _list = list;
     _items = list._items;
     _count = list._count;
     _index = 0;
 }
コード例 #13
0
ファイル: List.cs プロジェクト: w4x/boolangstudio
 void InnerCollect(List target, Predicate condition)
 {
     for (int i=0; i<_count; ++i)
     {
         object item = _items[i];
         if (condition(item))
         {
             target.Add(item);
         }
     }
 }
コード例 #14
0
ファイル: List.cs プロジェクト: w4x/boolangstudio
        public List Collect(List target, Predicate condition)
        {
            if (null == target)
            {
                throw new ArgumentNullException("target");
            }

            if (null == condition)
            {
                throw new ArgumentNullException("condition");
            }

            InnerCollect(target, condition);
            return target;
        }
コード例 #15
0
 public UnityScriptParser(ParserSharedInputState state) : base(state, 2)
 {
     if (!this.$initialized__UnityScript_Parser_UnityScriptParser$)
     {
         this._attributes = new AttributeCollection();
         this._loopStack = new List();
         this.$initialized__UnityScript_Parser_UnityScriptParser$ = true;
     }
     this.initialize();
 }
コード例 #16
0
 public UnityScriptParser(TokenBuffer tokenBuf) : this(tokenBuf, 2)
 {
     if (!this.$initialized__UnityScript_Parser_UnityScriptParser$)
     {
         this._attributes = new AttributeCollection();
         this._loopStack = new List();
         this.$initialized__UnityScript_Parser_UnityScriptParser$ = true;
     }
 }
コード例 #17
0
ファイル: ScriptDSLBase.cs プロジェクト: lafar6502/cogmon
 public ScriptDSLBase()
 {
     DataRecords = new List<DataRecord>();
     Out = new StringWriter();
 }
コード例 #18
0
 public UnityScriptParser(TokenStream lexer) : this(lexer, 2)
 {
     if (!this.$initialized__UnityScript_Parser_UnityScriptParser$)
     {
         this._attributes = new AttributeCollection();
         this._loopStack = new List();
         this.$initialized__UnityScript_Parser_UnityScriptParser$ = true;
     }
 }
コード例 #19
0
 public Expression array_initializer()
 {
     Expression expression = null;
     List<Expression> dimensions = new List<Expression>(1);
     try
     {
         TypeReference elementType = this.simple_type_reference();
         this.match(0x44);
         Expression item = this.sum();
         if (base.inputState.guessing == 0)
         {
             dimensions.Add(item);
         }
         while (this.LA(1) == 0x43)
         {
             this.match(0x43);
             item = this.sum();
             if (base.inputState.guessing == 0)
             {
                 dimensions.Add(item);
             }
         }
         this.match(0x45);
         if (base.inputState.guessing == 0)
         {
             expression = CodeFactory.NewArrayInitializer(elementType.get_LexicalInfo(), elementType, dimensions);
         }
     }
     catch (RecognitionException exception)
     {
         if (base.inputState.guessing != 0)
         {
             throw;
         }
         this.reportError(exception);
         this.recover(exception, tokenSet_20_);
         return expression;
     }
     return expression;
 }
コード例 #20
0
 protected UnityScriptParser(TokenStream lexer, int k) : base(lexer, k)
 {
     if (!this.$initialized__UnityScript_Parser_UnityScriptParser$)
     {
         this._attributes = new AttributeCollection();
         this._loopStack = new List();
         this.$initialized__UnityScript_Parser_UnityScriptParser$ = true;
     }
     this.initialize();
 }
コード例 #21
0
ファイル: List.cs プロジェクト: w4x/boolangstudio
 public static List operator +(List lhs, IEnumerable rhs)
 {
     List result = new List(lhs.Count);
     result.Extend(lhs);
     result.Extend(rhs);
     return result;
 }
コード例 #22
0
ファイル: List.cs プロジェクト: w4x/boolangstudio
        public List Collect(Predicate condition)
        {
            if (null == condition)
            {
                throw new ArgumentNullException("condition");
            }

            List newList = new List();
            InnerCollect(newList, condition);
            return newList;
        }
コード例 #23
0
ファイル: Builtins.cs プロジェクト: w4x/boolangstudio
        public static Array array(Type elementType, IEnumerable enumerable)
        {
            if (null == enumerable)
            {
                throw new ArgumentNullException("enumerable");
            }
            if (null == elementType)
            {
                throw new ArgumentNullException("elementType");
            }

            // future optimization, check EnumeratorItemType of enumerable
            // and get the fast path whenever possible
            List l = null;
            if (RuntimeServices.IsPromotableNumeric(Type.GetTypeCode(elementType)))
            {
                l = new List();
                foreach (object item in enumerable)
                {
                    object value = RuntimeServices.CheckNumericPromotion(item).ToType(elementType, null);
                    l.Add(value);
                }
            }
            else
            {
                l = new List(enumerable);
            }
            return l.ToArray(elementType);
        }
コード例 #24
0
 public SuppressWarnings(List<string> suppressed)
 {
     this._suppressed = suppressed;
 }