public override void OnSimpleTypeReference(SimpleTypeReference node)
 {
     if (node.Name == "System.Collections.IEnumerator")
     {
         node.Name = "IEnumerator";
     }
 }
Beispiel #2
0
			public override void Run()
			{
				var klass = new ClassDefinition { Name = "Foo" };
				var baseType = new SimpleTypeReference("object");
				klass.BaseTypes.Add(baseType);

				var method = new Method { Name = "Bar" };
				method.Body.Add(
					new ReturnStatement(
						new IntegerLiteralExpression(42)));
				klass.Members.Add(method);

				var module = CompileUnit.Modules[0];
				Assert.AreEqual(0, module.Members.Count);

				My<CodeReifier>.Instance.ReifyInto(module, klass);

				Assert.AreEqual(1, module.Members.Count);
				Assert.AreSame(klass, module.Members[0]);

				var klassEntity = (IType) klass.Entity;
				Assert.IsTrue(klassEntity.IsClass);
				Assert.AreSame(TypeSystemServices.ObjectType, klassEntity.BaseType);

				var methodEntity = (IMethod)method.Entity;
				Assert.AreEqual(method.Name, methodEntity.Name);
				Assert.AreSame(TypeSystemServices.IntType, methodEntity.ReturnType);
			}
 B.TypeReference ConvertTypeReference(TypeReference t)
 {
     if (t == null || t.IsNull)
     {
         return(null);
     }
     B.TypeReference r;
     if (t.GenericTypes.Count > 0)
     {
         r = new B.GenericTypeReference(GetLexicalInfo(t), GetIntrinsicTypeName(t.Type));
         foreach (TypeReference ta in t.GenericTypes)
         {
             ((B.GenericTypeReference)r).GenericArguments.Add(ConvertTypeReference(ta));
         }
     }
     else
     {
         r = new B.SimpleTypeReference(GetLexicalInfo(t), GetIntrinsicTypeName(t.Type));
     }
     if (t.IsArrayType)
     {
         for (int i = t.RankSpecifier.Length - 1; i >= 0; --i)
         {
             r = new B.ArrayTypeReference(GetLexicalInfo(t), r, new B.IntegerLiteralExpression(t.RankSpecifier[i] + 1));
         }
     }
     if (t.PointerNestingLevel != 0)
     {
         AddError(t, "Pointers are not supported by boo.");
     }
     return(r);
 }
		public void LiftCastExpressionWithSelfTarget()
		{
			var self = new SelfLiteralExpression();
			var typeReference = new SimpleTypeReference("T");
			Expression cast = new TryCastExpression(self, typeReference);
			var parameter = ParameterDeclaration.Lift(cast);
			Assert.AreEqual("self", parameter.Name);
			Assert.IsTrue(typeReference.Matches(parameter.Type));
			Assert.AreNotSame(typeReference, parameter.Type);
		}
		public void LiftCastExpression()
		{
			var referenceExpression = new ReferenceExpression("foo");
			var typeReference = new SimpleTypeReference("T");
			Expression cast = new TryCastExpression(referenceExpression, typeReference);
			var parameter = ParameterDeclaration.Lift(cast);
			Assert.AreEqual(referenceExpression.Name, parameter.Name);
			Assert.IsTrue(typeReference.Matches(parameter.Type));
			Assert.AreNotSame(typeReference, parameter.Type);
		}
        override public object Clone()
        {
            SimpleTypeReference clone = (SimpleTypeReference)FormatterServices.GetUninitializedObject(typeof(SimpleTypeReference));

            clone._lexicalInfo       = _lexicalInfo;
            clone._endSourceLocation = _endSourceLocation;
            clone._documentation     = _documentation;
            clone._entity            = _entity;
            if (_annotations != null)
            {
                clone._annotations = (Hashtable)_annotations.Clone();
            }

            clone._isPointer = _isPointer;
            clone._name      = _name;
            return(clone);
        }
Beispiel #7
0
        override public object Clone()
        {
            SimpleTypeReference clone = new SimpleTypeReference();

            clone._lexicalInfo       = _lexicalInfo;
            clone._endSourceLocation = _endSourceLocation;
            clone._documentation     = _documentation;
            clone._isSynthetic       = _isSynthetic;
            clone._entity            = _entity;
            if (_annotations != null)
            {
                clone._annotations = (Hashtable)_annotations.Clone();
            }
            clone._isPointer = _isPointer;
            clone._name      = _name;
            return(clone);
        }
Beispiel #8
0
 public object VisitCompilationUnit(CompilationUnit compilationUnit, object data)
 {
     module             = new B.Module();
     module.LexicalInfo = new B.LexicalInfo(fileName, 1, 1);
     compilationUnit.AcceptChildren(this, data);
     if (entryPointMethod != null)
     {
         bool allMembersAreStatic = true;
         foreach (B.TypeMember member in entryPointMethod.DeclaringType.Members)
         {
             allMembersAreStatic &= member.IsStatic;
         }
         if (allMembersAreStatic)
         {
             entryPointMethod.DeclaringType.Attributes.Add(MakeAttribute(("module")));
         }
         else
         {
             lastLexicalInfo = entryPointMethod.LexicalInfo;
             B.Expression expr = MakeReferenceExpression(entryPointMethod.DeclaringType.Name + ".Main");
             B.MethodInvocationExpression mie = new B.MethodInvocationExpression(lastLexicalInfo, expr);
             if (entryPointMethod.Parameters.Count > 0)
             {
                 mie.Arguments.Add(MakeReferenceExpression("argv"));
             }
             B.SimpleTypeReference ret = entryPointMethod.ReturnType as B.SimpleTypeReference;
             if (ret.Name == "void" || ret.Name == "System.Void")
             {
                 module.Globals.Add(new B.ExpressionStatement(mie));
             }
             else
             {
                 module.Globals.Add(new B.ReturnStatement(lastLexicalInfo, mie, null));
             }
         }
     }
     B.Module tmp = module;
     module = null;
     return(tmp);
 }
Beispiel #9
0
		public void MergeIgnoresMatchingBaseTypes()
		{
			var foo = new SimpleTypeReference("Foo");
			var bar = new SimpleTypeReference("Bar");
			var fooOfBar = new GenericTypeReference("Foo", bar);
			var barOfFoo = new GenericTypeReference("Bar", foo);
			
			var subject = new ClassDefinition();
			subject.BaseTypes.Add(bar);
			subject.BaseTypes.Add(fooOfBar);

			var node = new ClassDefinition();
			node.BaseTypes.Add(foo);
			node.BaseTypes.Add(bar.CloneNode());
			node.BaseTypes.Add(fooOfBar.CloneNode());
			node.BaseTypes.Add(barOfFoo);

			subject.Merge(node);

			Assert.AreEqual(new[] { bar, fooOfBar, foo, barOfFoo }, subject.BaseTypes.ToArray());

		}
Beispiel #10
0
 B.Expression MakeReferenceExpression(TypeReference typeRef)
 {
     if (typeRef.IsArrayType)
     {
         return(new B.TypeofExpression(GetLexicalInfo(typeRef), ConvertTypeReference(typeRef)));
     }
     B.SimpleTypeReference t = (B.SimpleTypeReference)ConvertTypeReference(typeRef);
     B.ReferenceExpression r = MakeReferenceExpression(t.Name);
     if (t is B.GenericTypeReference)
     {
         B.GenericReferenceExpression gr = new B.GenericReferenceExpression(GetLexicalInfo(typeRef));
         gr.Target = r;
         foreach (B.TypeReference tr in ((B.GenericTypeReference)t).GenericArguments)
         {
             gr.GenericArguments.Add(tr);
         }
         return(gr);
     }
     else
     {
         return(r);
     }
 }
		private void GenerateConstructors(TypeDefinition definition)
		{
			ConstructorInfo[] ctors =
				baseClass.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
			foreach (ConstructorInfo ctor in ctors)
			{
				if (ctor.IsPrivate)
					continue;
				Constructor constructor = new Constructor(definition.LexicalInfo);
				definition.Members.Add(constructor);
				MethodInvocationExpression super = new MethodInvocationExpression(new SuperLiteralExpression());
				constructor.Body.Add(super);
				foreach (ParameterInfo info in ctor.GetParameters())
				{
					SimpleTypeReference typeReference =
						new SimpleTypeReference(TypeUtilities.GetFullName(info.ParameterType));
					constructor.Parameters.Add(new ParameterDeclaration(info.Name,
																		typeReference)
						);
					super.Arguments.Add(new ReferenceExpression(info.Name));
				}
			}
		}
Beispiel #12
0
 public override void OnSimpleTypeReference(SimpleTypeReference node)
 {
     NameResolutionService.ResolveSimpleTypeReference(node);
 }
		public static GenericParameterDeclaration Lift(SimpleTypeReference simpleTypeRef)
		{
			return new GenericParameterDeclaration(simpleTypeRef.Name);
		}
        private IEntity ResolveTypeName(SimpleTypeReference node)
        {
            _buffer.Clear();
            if (IsQualifiedName(node.Name))
            {
                ResolveQualifiedName(_buffer, node.Name);
            }
            else
            {
                Resolve(_buffer, node.Name, EntityType.Type);
            }

            // Remove from the buffer types that do not match requested generity
            FilterGenericTypes(_buffer, node);
            return GetEntityFromBuffer();
        }
		public override void OnSimpleTypeReference(SimpleTypeReference node)
		{
			MakeTypeResult(ConvertType(node));
		}
 public override void OnSimpleTypeReference(SimpleTypeReference node)
 {
     node.Name = this.UnityScriptTypeNameToBooTypeName(node.Name);
 }
 public override void OnSimpleTypeReference(SimpleTypeReference node)
 {
     node.Name = UnityScriptTypeNameToCSharpTypeName(node.Name);
 }
Beispiel #18
0
        private void CheckForCycles(SimpleTypeReference baseTypeRef, AbstractInternalType baseType, List visited)
        {
            if (visited.Contains(baseType.TypeDefinition))
            {
                BaseTypeError(CompilerErrorFactory.InheritanceCycle(baseTypeRef, baseType.FullName));
                return;
            }

            new BaseTypeResolution(Context, baseType.TypeDefinition, visited);
        }
 public TypeReference simple_type_reference()
 {
     TypeReference reference = null;
     try
     {
         Token token = this.qname();
         if ((this.LA(1) == 0x41) && (this.LA(2) == 0x5b))
         {
             TypeReferenceCollection references;
             this.match(0x41);
             this.match(0x5b);
             if (base.inputState.guessing == 0)
             {
                 GenericTypeReference reference2;
                 reference = reference2 = new GenericTypeReference(ToLexicalInfo(token), token.getText());
                 references = reference2.get_GenericArguments();
             }
             this.type_reference_list(references);
             this.match(0x5f);
             return reference;
         }
         if (!tokenSet_35_.member(this.LA(1)) || !tokenSet_25_.member(this.LA(2)))
         {
             throw new NoViableAltException(this.LT(1), this.getFilename());
         }
         if (base.inputState.guessing == 0)
         {
             SimpleTypeReference reference3;
             SimpleTypeReference reference1 = reference3 = new SimpleTypeReference(ToLexicalInfo(token));
             reference3.set_Name(token.getText());
             reference = reference3;
         }
         return reference;
     }
     catch (RecognitionException exception)
     {
         if (base.inputState.guessing != 0)
         {
             throw;
         }
         this.reportError(exception);
         this.recover(exception, tokenSet_35_);
         return reference;
     }
     return reference;
 }
Beispiel #20
0
	protected TypeReference  type_reference() //throws RecognitionException, TokenStreamException
{
		TypeReference tr;
		
		
				tr = null;
				IToken id = null;
				TypeReferenceCollection arguments = null;
				GenericTypeDefinitionReference gtdr = null;
			
		
		try {      // for error handling
			{
				switch ( LA(1) )
				{
				case SPLICE_BEGIN:
				{
					tr=splice_type_reference();
					break;
				}
				case LPAREN:
				{
					tr=array_type_reference();
					break;
				}
				default:
					bool synPredMatched251 = false;
					if (((LA(1)==CALLABLE) && (LA(2)==LPAREN)))
					{
						int _m251 = mark();
						synPredMatched251 = true;
						inputState.guessing++;
						try {
							{
								match(CALLABLE);
								match(LPAREN);
							}
						}
						catch (RecognitionException)
						{
							synPredMatched251 = false;
						}
						rewind(_m251);
						inputState.guessing--;
					}
					if ( synPredMatched251 )
					{
						{
							tr=callable_type_reference();
						}
					}
					else if ((tokenSet_43_.member(LA(1))) && (tokenSet_44_.member(LA(2)))) {
						{
							id=type_name();
							{
								if ((LA(1)==LBRACK) && (tokenSet_45_.member(LA(2))))
								{
									{
										match(LBRACK);
										{
											switch ( LA(1) )
											{
											case OF:
											{
												match(OF);
												break;
											}
											case CALLABLE:
											case CHAR:
											case THEN:
											case LPAREN:
											case ID:
											case MULTIPLY:
											case SPLICE_BEGIN:
											{
												break;
											}
											default:
											{
												throw new NoViableAltException(LT(1), getFilename());
											}
											 }
										}
										{
											switch ( LA(1) )
											{
											case MULTIPLY:
											{
												{
													match(MULTIPLY);
													if (0==inputState.guessing)
													{
														
																					gtdr = new GenericTypeDefinitionReference(ToLexicalInfo(id));
																					gtdr.Name = id.getText();
																					gtdr.GenericPlaceholders = 1;
																					tr = gtdr;										
																				
													}
													{    // ( ... )*
														for (;;)
														{
															if ((LA(1)==COMMA))
															{
																match(COMMA);
																match(MULTIPLY);
																if (0==inputState.guessing)
																{
																	
																									gtdr.GenericPlaceholders++;
																								
																}
															}
															else
															{
																goto _loop260_breakloop;
															}
															
														}
_loop260_breakloop:														;
													}    // ( ... )*
													match(RBRACK);
												}
												break;
											}
											case CALLABLE:
											case CHAR:
											case THEN:
											case LPAREN:
											case ID:
											case SPLICE_BEGIN:
											{
												{
													if (0==inputState.guessing)
													{
														
																					GenericTypeReference gtr = new GenericTypeReference(ToLexicalInfo(id), id.getText());
																					arguments = gtr.GenericArguments;
																					tr = gtr;
																				
													}
													type_reference_list(arguments);
													match(RBRACK);
												}
												break;
											}
											default:
											{
												throw new NoViableAltException(LT(1), getFilename());
											}
											 }
										}
									}
								}
								else if ((LA(1)==OF) && (LA(2)==MULTIPLY)) {
									{
										match(OF);
										match(MULTIPLY);
										if (0==inputState.guessing)
										{
											
																gtdr = new GenericTypeDefinitionReference(ToLexicalInfo(id));
																gtdr.Name = id.getText();
																gtdr.GenericPlaceholders = 1;
																tr = gtdr;
															
										}
									}
								}
								else if ((LA(1)==OF) && (tokenSet_46_.member(LA(2)))) {
									{
										match(OF);
										tr=type_reference();
										if (0==inputState.guessing)
										{
											
																GenericTypeReference gtr = new GenericTypeReference(ToLexicalInfo(id), id.getText());
																gtr.GenericArguments.Add(tr);
																tr = gtr;
															
										}
									}
								}
								else if ((tokenSet_44_.member(LA(1))) && (tokenSet_15_.member(LA(2)))) {
									if (0==inputState.guessing)
									{
										
														SimpleTypeReference str = new SimpleTypeReference(ToLexicalInfo(id));
														str.Name = id.getText();
														tr = str;
													
									}
								}
								else
								{
									throw new NoViableAltException(LT(1), getFilename());
								}
								
							}
							{
								if ((LA(1)==NULLABLE_SUFFIX) && (tokenSet_44_.member(LA(2))))
								{
									match(NULLABLE_SUFFIX);
									if (0==inputState.guessing)
									{
										
														GenericTypeReference ntr = new GenericTypeReference(tr.LexicalInfo, "System.Nullable");
														ntr.GenericArguments.Add(tr);
														tr = ntr;
													
									}
								}
								else if ((tokenSet_44_.member(LA(1))) && (tokenSet_15_.member(LA(2)))) {
								}
								else
								{
									throw new NoViableAltException(LT(1), getFilename());
								}
								
							}
						}
					}
				else
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				break; }
			}
			{    // ( ... )*
				for (;;)
				{
					if ((LA(1)==MULTIPLY) && (tokenSet_44_.member(LA(2))))
					{
						match(MULTIPLY);
						if (0==inputState.guessing)
						{
							tr = CodeFactory.EnumerableTypeReferenceFor(tr);
						}
					}
					else if ((LA(1)==EXPONENTIATION) && (tokenSet_44_.member(LA(2)))) {
						match(EXPONENTIATION);
						if (0==inputState.guessing)
						{
							tr = CodeFactory.EnumerableTypeReferenceFor(CodeFactory.EnumerableTypeReferenceFor(tr));
						}
					}
					else
					{
						goto _loop266_breakloop;
					}
					
				}
_loop266_breakloop:				;
			}    // ( ... )*
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "type_reference");
				recover(ex,tokenSet_44_);
			}
			else
			{
				throw ex;
			}
		}
		return tr;
	}
            protected override Statement ExpandImpl(MacroStatement macro)
            {
                Module module = macro.findModule();

                string propname = "";
                TypeReference type = new SimpleTypeReference("System.Object");
                Expression initializer = null;

                if (macro.Arguments[0] is BinaryExpression)
                {
                    var bin = macro.Arguments[0] as BinaryExpression;
                    initializer = bin.Right;
                    if (bin.Left is TryCastExpression)
                    {
                        var tce = bin.Left as TryCastExpression;
                        propname = tce.Target.ToCodeString();
                        type = tce.Type ?? type;
                    }
                    //else
                    //{
                    //    propname = bin.Left.ToCodeString();
                    //}
                }
                //else
                //{
                //    propname = macro.Arguments[0].ToCodeString();
                //}

                var geter = new Method("get_" + propname);
                geter.ReturnType = type;
                geter.Body = new Block();
                if (initializer != null)
                {
                    geter.Body.add(
                        new IfStatement(
                            new BinaryExpression(
                                BinaryOperatorType.Equality,
                                new NullLiteralExpression(),
                                new MethodInvocationExpression(
                                    new ReferenceExpression("TryGetParameterNoIgnoreNull"),
                                    new StringLiteralExpression(propname))
                                ),
                            new Block().add(new MethodInvocationExpression(
                                                new ReferenceExpression("SetProperty"),
                                                new StringLiteralExpression(propname),
                                                initializer ?? new NullLiteralExpression()))
                            , null
                            )
                        );
                }


                var convertmethod = new GenericReferenceExpression();
                convertmethod.Target = new ReferenceExpression("_convert");
                convertmethod.GenericArguments.Add(type);
                var valuecall = new MethodInvocationExpression(
                    new ReferenceExpression("TryGetParameterNoIgnoreNull"),
                    new StringLiteralExpression(propname));
                var convertcall = new MethodInvocationExpression(convertmethod,valuecall);
                
                geter.Body.add(new ReturnStatement(new CastExpression(convertcall, type)));

                var seter = new Method("set_" + propname);
                seter.Body = new Block().add(new MethodInvocationExpression(
                                                 new ReferenceExpression("SetProperty"),
                                                 new StringLiteralExpression(propname),
                                                 new ReferenceExpression("value")));

                var prop = new Property(geter, seter, type);
                prop.Name = propname;
                //try
                //{
                    ((TypeDefinition)module.Members[0]).Members.Insert(0, prop);
                //}
                //catch
                //{
                //    module.Members.Insert(0, prop); //in test env
                //}
                return null;
            }
        public void try_statement(Block container)
        {
            IToken token = null;
            IToken token2 = null;
            IToken token3 = null;
            try
            {
                TryStatement statement;
                Block block;
                token = this.LT(1);
                this.match(0x2b);
                if (base.inputState.guessing == 0)
                {
                    statement = new TryStatement(ToLexicalInfo(token));
                    block = statement.get_ProtectedBlock();
                    container.Add(statement);
                }
                this.compound_or_single_stmt(block);
                while (true)
                {
                    TypeReference reference;
                    if ((this.LA(1) != 7) || (this.LA(2) != 0x3f))
                    {
                        break;
                    }
                    token2 = this.LT(1);
                    this.match(7);
                    this.match(0x3f);
                    token3 = this.LT(1);
                    this.match(0x3b);
                    switch (this.LA(1))
                    {
                        case 0x42:
                            this.match(0x42);
                            reference = this.type_reference();
                            break;

                        case 0x40:
                            break;

                        default:
                            throw new NoViableAltException(this.LT(1), this.getFilename());
                    }
                    this.match(0x40);
                    if (base.inputState.guessing == 0)
                    {
                        Declaration declaration;
                        ExceptionHandler handler;
                        if (reference == null)
                        {
                            reference = new SimpleTypeReference(ToLexicalInfo(token3), "System.Exception");
                        }
                        ExceptionHandler handler1 = handler = new ExceptionHandler(ToLexicalInfo(token2));
                        Declaration declaration1 = declaration = new Declaration(ToLexicalInfo(token3));
                        declaration.set_Name(token3.getText());
                        declaration.set_Type(reference);
                        handler.set_Declaration(declaration);
                        ExceptionHandler handler2 = handler;
                        statement.get_ExceptionHandlers().Add(handler2);
                        block = handler2.get_Block();
                        reference = null;
                    }
                    this.compound_or_single_stmt(block);
                }
                if ((this.LA(1) != 0x11) || !tokenSet_2_.member(this.LA(2)))
                {
                    if (!tokenSet_15_.member(this.LA(1)) || !tokenSet_20_.member(this.LA(2)))
                    {
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                    }
                }
                else
                {
                    this.finally_block(statement);
                }
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_15_);
            }
        }
 public override void OnSimpleTypeReference(SimpleTypeReference node)
 {
     this.CheckTypeReference(node);
 }
		public void LiftSimpleTypeReference()
		{
			var simpleTypeRef = new SimpleTypeReference("foo");
			var parameter = GenericParameterDeclaration.Lift(simpleTypeRef);
			Assert.AreEqual(simpleTypeRef.Name, parameter.Name);
		}
Beispiel #25
0
        public TypeReference CreateTypeReference(IType tag)
        {
            TypeReference typeReference = null;

            if (tag.IsArray)
            {
                IArrayType arrayType = (IArrayType) tag;
                IType elementType = arrayType.ElementType;
                //typeReference = new ArrayTypeReference();
                //((ArrayTypeReference)typeReference).ElementType = CreateTypeReference(elementType);
                // FIXME: This is what it *should* be, but it causes major breakage. ??
                typeReference = new ArrayTypeReference(CreateTypeReference(elementType), CreateIntegerLiteral(arrayType.Rank));
            }
            else
            {
                typeReference = new SimpleTypeReference(tag.FullName);
            }

            typeReference.Entity = tag;
            return typeReference;
        }
 private IEntity NameNotType(SimpleTypeReference node)
 {
     string suggestion = GetMostSimilarTypeName(node.Name);
     _context.Errors.Add(CompilerErrorFactory.NameNotType(node, node.ToCodeString(), suggestion));
     return TypeSystemServices.ErrorEntity;
 }
 private static TypeReference GetTypeReference(Type type)
 {
     TypeReference typeReference;
     if (type.IsGenericType)
     {
         var genericArguments = type.GetGenericArguments();
         typeReference = new GenericTypeReference(
             TypeUtilities.GetFullName(type),
             genericArguments.Select(a => GetTypeReference(a)).ToArray());
     }
     else
     {
         typeReference = new SimpleTypeReference(TypeUtilities.GetFullName(type));
     }
     return typeReference;
 }
Beispiel #28
0
 public override void OnSimpleTypeReference(SimpleTypeReference t)
 {
     Write(t.Name);
 }
 public override void OnSimpleTypeReference(SimpleTypeReference node)
 {
     if (node.LexicalInfo != null)
         results.MapParsedNode(new MappedTypeReference(results, node));
     base.OnSimpleTypeReference(node);
 }
 public static GenericParameterDeclaration Lift(SimpleTypeReference simpleTypeRef)
 {
     return(new GenericParameterDeclaration(simpleTypeRef.Name));
 }
Beispiel #31
0
		public override void OnSimpleTypeReference(SimpleTypeReference node)
		{
			CheckForInnerGenericParameterReferenceUsage(node);
		}
 public MappedTypeReference(CompileResults results, SimpleTypeReference node)
     : base(results, node, node.Name.Length)
 {
 }
Beispiel #33
0
		override public object Clone()
		{
		
			SimpleTypeReference clone = new SimpleTypeReference();
			clone._lexicalInfo = _lexicalInfo;
			clone._endSourceLocation = _endSourceLocation;
			clone._documentation = _documentation;
			clone._isSynthetic = _isSynthetic;
			clone._entity = _entity;
			if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
			clone._isPointer = _isPointer;
			clone._name = _name;
			return clone;


		}
		B.TypeReference ConvertTypeReference(TypeReference t)
		{
			if (t == null || t.IsNull)
				return null;
			B.TypeReference r;
			if (t.GenericTypes.Count > 0) {
				r = new B.GenericTypeReference(GetLexicalInfo(t), GetIntrinsicTypeName(t.Type));
				foreach (TypeReference ta in t.GenericTypes) {
					((B.GenericTypeReference)r).GenericArguments.Add(ConvertTypeReference(ta));
				}
			} else {
				r = new B.SimpleTypeReference(GetLexicalInfo(t), GetIntrinsicTypeName(t.Type));
			}
			if (t.IsArrayType) {
				for (int i = t.RankSpecifier.Length - 1; i >= 0; --i) {
					r = new B.ArrayTypeReference(GetLexicalInfo(t), r, new B.IntegerLiteralExpression(t.RankSpecifier[i] + 1));
				}
			}
			if (t.PointerNestingLevel != 0) {
				AddError(t, "Pointers are not supported by boo.");
			}
			return r;
		}
Beispiel #35
0
 public override void OnSimpleTypeReference(SimpleTypeReference node)
 {
     CheckName(node,node.Name);
 }
Beispiel #36
0
 /* the simple type references that happen while visiting a
  * class defintion are its base class and implemented interfaces
  * */
 public override void OnSimpleTypeReference(SimpleTypeReference node)
 {
     if (_current != null && !_current.BaseTypes.Contains(node.Name))
     {
         _current.BaseTypes.Add(node);
     }
 }