override public object Clone()
        {
            DeclarationStatement clone = (DeclarationStatement)FormatterServices.GetUninitializedObject(typeof(DeclarationStatement));

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

            if (null != _modifier)
            {
                clone._modifier = _modifier.Clone() as StatementModifier;
                clone._modifier.InitializeParent(clone);
            }
            if (null != _declaration)
            {
                clone._declaration = _declaration.Clone() as Declaration;
                clone._declaration.InitializeParent(clone);
            }
            if (null != _initializer)
            {
                clone._initializer = _initializer.Clone() as Expression;
                clone._initializer.InitializeParent(clone);
            }
            return(clone);
        }
Example #2
0
        protected override Statement ExpandImpl(MacroStatement macro){
            var result = new Block();
            foreach (Statement st in macro.Body.Statements){
                var decl = st as DeclarationStatement;
                var refer = st as ExpressionStatement;
                if(null==decl){
                    var ex = refer.Expression;
                    if (ex is MethodInvocationExpression){
                        decl =
                            new DeclarationStatement(
                                new Declaration(((MethodInvocationExpression) refer.Expression).Target.ToCodeString(),
                                                null), null);
                    }
                    if(ex is BinaryExpression){
                        var b = ex as BinaryExpression;
                        decl = new DeclarationStatement(
                            new Declaration(b.Left.ToCodeString(),null),b.Right
                            );
                    }
                }

                var bin = new BinaryExpression(BinaryOperatorType.Assign,
                                               new TryCastExpression(new ReferenceExpression(decl.Declaration.Name),
                                                                     decl.Declaration.Type),
                                               decl.Initializer);
                var def = new MacroStatement("definebrailproperty");
                def.Arguments.Add(bin);
                result.Add(def);
            }
            return result;
        }
        override public object Clone()
        {
            DeclarationStatement clone = new DeclarationStatement();

            clone._lexicalInfo       = _lexicalInfo;
            clone._endSourceLocation = _endSourceLocation;
            clone._documentation     = _documentation;
            clone._isSynthetic       = _isSynthetic;
            clone._entity            = _entity;
            if (_annotations != null)
            {
                clone._annotations = (Hashtable)_annotations.Clone();
            }
            if (null != _modifier)
            {
                clone._modifier = _modifier.Clone() as StatementModifier;
                clone._modifier.InitializeParent(clone);
            }
            if (null != _declaration)
            {
                clone._declaration = _declaration.Clone() as Declaration;
                clone._declaration.InitializeParent(clone);
            }
            if (null != _initializer)
            {
                clone._initializer = _initializer.Clone() as Expression;
                clone._initializer.InitializeParent(clone);
            }
            return(clone);
        }
		static void ReplaceWithInitializer(DeclarationStatement decl)
		{
			if (decl.Initializer == null) {
				decl.ReplaceBy(null);
			} else {
				ExpressionStatement statement = new ExpressionStatement(decl.LexicalInfo);
				statement.Expression = new BinaryExpression(decl.LexicalInfo, BinaryOperatorType.Assign,
				                                            new ReferenceExpression(decl.Declaration.LexicalInfo, decl.Declaration.Name),
				                                            decl.Initializer);
				decl.ReplaceBy(statement);
			}
		}
Example #5
0
		public static TypeMember Lift(DeclarationStatement stmt)
		{
			var closure = stmt.Initializer as BlockExpression;
			if (closure != null && closure.ContainsAnnotation(BlockExpression.ClosureNameAnnotation))
				return TypeMember.Lift(closure);

			return new Field(stmt.LexicalInfo)
			       	{
			       		Name = stmt.Declaration.Name,
						Type = stmt.Declaration.Type,
						Initializer = stmt.Initializer
			       	};
		}
Example #6
0
        public object VisitLocalVariableDeclaration(LocalVariableDeclaration lvd, object data)
        {
            ArrayList list = new ArrayList();

            for (int i = 0; i < lvd.Variables.Count; i++)
            {
                B.DeclarationStatement varDecl = new B.DeclarationStatement(GetLexicalInfo(lvd));
                varDecl.Declaration = new B.Declaration(GetLexicalInfo(lvd.Variables[i]), lvd.Variables[i].Name, ConvertTypeReference(lvd.GetTypeForVariable(i)));
                varDecl.Initializer = ConvertExpression(lvd.Variables[i].Initializer);
                list.Add(varDecl);
            }
            return(list);
        }
        public override void LeaveDeclarationStatement(DeclarationStatement node)
        {
            if (node.Declaration.Type != null)
            {
                Expression initializer = node.Initializer;
                if (initializer is TryCastExpression)
                {
                    TryCastExpression tryCastExpression = (TryCastExpression)initializer;

                    Expression target = tryCastExpression.Target;
                    TypeReference type = tryCastExpression.Type;
                    node.Initializer = target;
                }
            }
        }
Example #8
0
 public static Statement read (Expression expression){
     Declaration declaraion = new Declaration();
     declaraion.Name = "readedContent";
     Expression arg = null;
     
     if (expression is BinaryExpression){
         var ass = expression as BinaryExpression;
         declaraion.Name=ass.Left.LiftToString();
         arg = ass.Right;
     }else{
         arg = expression;
     }
     MethodInvocationExpression assign = AstUtil.CreateMethodInvocationExpression(AstUtil.CreateReferenceExpression("System.IO.File.ReadAllText"), arg);
     var result =  new DeclarationStatement(declaraion, assign);
     return result;
 }
Example #9
0
        public static TypeMember Lift(DeclarationStatement stmt)
        {
            var closure = stmt.Initializer as BlockExpression;

            if (closure != null && closure.ContainsAnnotation(BlockExpression.ClosureNameAnnotation))
            {
                return(TypeMember.Lift(closure));
            }

            return(new Field(stmt.LexicalInfo)
            {
                Name = stmt.Declaration.Name,
                Type = stmt.Declaration.Type,
                Initializer = stmt.Initializer
            });
        }
		public static void RenameLocals(Block block, StringComparer nameComparer)
		{
			FindVariableDeclarationsVisitor fvdv = new FindVariableDeclarationsVisitor();
			block.Accept(fvdv);
			List<DeclarationStatement> list = new List<DeclarationStatement>();
			foreach (DeclarationStatement decl in fvdv.Declarations) {
				DeclarationStatement conflict = null;
				int conflictIndex = -1;
				for (int i = 0; i < list.Count; i++) {
					if (nameComparer.Equals(list[i].Declaration.Name, decl.Declaration.Name)) {
						conflict = list[i];
						conflictIndex = i;
						break;
					}
				}
				if (conflict == null) {
					list.Add(decl);
				} else {
					// Handle conflict: try if "moveup" would be sufficient
					if (IsSameType(decl.Declaration.Type, conflict.Declaration.Type, nameComparer)) {
						// create declaration at beginning of class and
						// replace decl & conflict by assignment
						DeclarationStatement newDecl = new DeclarationStatement(conflict.LexicalInfo);
						newDecl.Declaration = new Declaration(conflict.Declaration.LexicalInfo, conflict.Declaration.Name, conflict.Declaration.Type);
						block.Insert(0, newDecl);
						ReplaceWithInitializer(decl);
						ReplaceWithInitializer(conflict);
						list[conflictIndex] = newDecl;
					} else {
						string newName = FindFreeName(decl.Declaration.Name, list, fvdv.Declarations, nameComparer);
						decl.ParentNode.Accept(new RenameLocalsVisitor(decl.Declaration.Name, newName, nameComparer));
						decl.Declaration.Name = newName;
					}
				}
			}
		}
        public void declaration_statement(Block b)
        {
            try
            {
                Expression expression;
                Declaration declaration = this.declaration();
                switch (this.LA(1))
                {
                    case 0x4e:
                        this.match(0x4e);
                        expression = this.expression();
                        break;

                    case 1:
                    case 5:
                    case 7:
                    case 8:
                    case 9:
                    case 10:
                    case 11:
                    case 12:
                    case 13:
                    case 15:
                    case 0x10:
                    case 0x11:
                    case 0x12:
                    case 0x13:
                    case 20:
                    case 0x15:
                    case 0x19:
                    case 0x1b:
                    case 0x1d:
                    case 30:
                    case 0x1f:
                    case 0x20:
                    case 0x21:
                    case 0x23:
                    case 0x24:
                    case 0x25:
                    case 0x26:
                    case 0x27:
                    case 40:
                    case 0x29:
                    case 0x2a:
                    case 0x2b:
                    case 0x2c:
                    case 0x2d:
                    case 0x2e:
                    case 0x2f:
                    case 0x30:
                    case 0x31:
                    case 50:
                    case 0x33:
                    case 0x3b:
                    case 60:
                    case 0x3d:
                    case 0x3e:
                    case 0x3f:
                    case 0x44:
                    case 0x4d:
                    case 0x4f:
                    case 80:
                    case 0x52:
                    case 0x58:
                    case 0x63:
                    case 0x67:
                    case 0x69:
                    case 0x6a:
                    case 0x6b:
                    case 0x6c:
                    case 0x6d:
                        break;

                    default:
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                }
                if (base.inputState.guessing == 0)
                {
                    DeclarationStatement statement;
                    DeclarationStatement statement1 = statement = new DeclarationStatement(declaration.get_LexicalInfo());
                    statement.set_Declaration(declaration);
                    statement.set_Initializer(expression);
                    DeclarationStatement statement2 = statement;
                    b.Add(statement2);
                }
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_15_);
            }
        }
Example #12
0
        public Expression Linqify(BlockExpression nodeToConvert, BlockExpression originalNode)
        {
            //assert on param
            //assert one expression statement
            if (nodeToConvert.Parameters.Count > 1)
            {
                throw new NotSupportedException("Only lambdas with zero or one parameter are supported");
            }
            if (nodeToConvert.Body.Statements.Count != 1 &&
                nodeToConvert.Body.FirstStatement as ExpressionStatement == null)
            {
                throw new NotSupportedException("A lambda expression with a statement body cannot be converted to an expression tree");
            }

            var closureReturnType = CodeBuilder.CreateTypeReference((originalNode.ExpressionType as ICallableType).GetSignature().ReturnType);
            var bodyReturnType = CodeBuilder.CreateTypeReference((originalNode.Body.FirstStatement as ReturnStatement).Expression.ExpressionType);
            var hasParameters = nodeToConvert.Parameters.Count == 1;
            if (hasParameters)
            {
                var closureParameter = originalNode.Parameters[0];

                var exprP1Init = new DeclarationStatement(new Declaration(nodeToConvert.LexicalInfo, CompilerContext.Current.GetUniqueName(closureParameter.Name)),
                    new MethodInvocationExpression(ReferenceExpression.Lift("System.Linq.Expressions.Expression.Parameter"),
                        new TypeofExpression() { Type = closureParameter.Type },
                        new StringLiteralExpression(closureParameter.Name)));
                var exprP1Ref = new ReferenceExpression(exprP1Init.Declaration.Name);

                var visitor = new GeneratorExpressionTrees(closureParameter.Name, exprP1Ref, NameResolutionService, CodeBuilder);
                visitor.Visit(nodeToConvert.Body);
                var constructedExpression = visitor.Expression;
                constructedExpression = AddOptionalConvert(closureReturnType, bodyReturnType, constructedExpression);
                var exprLambdaGenericArg = new GenericTypeReference("System.Func", closureParameter.Type, closureReturnType);
                var exprLambdaCall = new GenericReferenceExpression()
                {
                    Target = ReferenceExpression.Lift("System.Linq.Expressions.Expression.Lambda"),
                    GenericArguments = { exprLambdaGenericArg }
                };
                var resultExpr = new MethodInvocationExpression(exprLambdaCall,
                    constructedExpression,
                    exprP1Ref);

                var linqify = new BlockExpression();
                var returnType = new GenericTypeReference("System.Linq.Expressions.Expression", exprLambdaGenericArg);
                NameResolutionService.ResolveSimpleTypeReference(returnType);
                //this must be set to allow proper type inference
                originalNode.ExpressionType = returnType.Entity as IType;

                linqify.ReturnType = returnType;
                linqify.Body.Add(exprP1Init);
                linqify.Body.Add(new ReturnStatement(resultExpr));
                return new MethodInvocationExpression(linqify);
            }
            else
            {
                var visitor = new GeneratorExpressionTrees(null, null, NameResolutionService, CodeBuilder);
                visitor.Visit(nodeToConvert.Body);
                var constructedExpression = visitor.Expression;
                constructedExpression = AddOptionalConvert(closureReturnType, bodyReturnType, constructedExpression);
                var exprLambdaGenericArg = new GenericTypeReference("System.Func", closureReturnType);
                var exprLambdaCall = new GenericReferenceExpression()
                {
                    Target = ReferenceExpression.Lift("System.Linq.Expressions.Expression.Lambda"),
                    GenericArguments = { exprLambdaGenericArg }
                };
                var resultExpr = new MethodInvocationExpression(exprLambdaCall,
                    constructedExpression);

                var linqify = new BlockExpression();
                var returnType = new GenericTypeReference("System.Linq.Expressions.Expression", exprLambdaGenericArg);
                NameResolutionService.ResolveSimpleTypeReference(returnType);
                //this must be set to allow proper type inference
                originalNode.ExpressionType = returnType.Entity as IType;

                linqify.ReturnType = returnType;
                linqify.Body.Add(new ReturnStatement(resultExpr));
                return new MethodInvocationExpression(linqify);
            }
        }
		public override void OnDeclarationStatement(DeclarationStatement node)
		{
			if (node.Declaration.Type != null && !SearchField(node.Declaration.Name)) {
				TypeReference initializerType = GetInferredType(node.Initializer);
				if (node.Declaration.Type.Matches(initializerType)) {
					node.Declaration.Type = null;
				}
			}
			base.OnDeclarationStatement(node);
		}
Example #14
0
 private IType GetDeclarationType(DeclarationStatement node)
 {
     return GetType(node.Declaration.Type);
 }
Example #15
0
        public override void LeaveDeclarationStatement(DeclarationStatement node)
        {
            EnsureDeclarationType(node);
            AssertDeclarationName(node.Declaration);

            var type = GetDeclarationType(node);

            var localInfo = DeclareLocal(node, node.Declaration.Name, type);
            var loopLocal = localInfo as InternalLocal;
            if (null != loopLocal)
                loopLocal.OriginalDeclaration = node.Declaration;

            if (node.Initializer != null)
            {
                IType initializerType = GetExpressionType(node.Initializer);
                if (CheckDeclarationType(node.Declaration.Type))
                    AssertTypeCompatibility(node.Initializer, type, initializerType);

                if (TypeSystemServices.IsNullable(type) && !TypeSystemServices.IsNullable(initializerType))
                    BindNullableInitializer(node, node.Initializer, type);

                node.ReplaceBy(
                    new ExpressionStatement(
                        CodeBuilder.CreateAssignment(
                            node.LexicalInfo,
                            CodeBuilder.CreateReference(localInfo),
                            node.Initializer)));
            }
            else
                node.ReplaceBy(new ExpressionStatement(CreateDefaultLocalInitializer(node, localInfo)));
        }
Example #16
0
	protected DeclarationStatement  declaration_stmt() //throws RecognitionException, TokenStreamException
{
		DeclarationStatement s;
		
		IToken  id = null;
		
				s = null;
				TypeReference tr = null;
				Expression initializer = null;
				StatementModifier m = null;
			
		
		try {      // for error handling
			id = LT(1);
			match(ID);
			match(AS);
			tr=type_reference();
			{
				switch ( LA(1) )
				{
				case ASSIGN:
				{
					{
						match(ASSIGN);
						{
							if (((tokenSet_95_.member(LA(1))) && (tokenSet_96_.member(LA(2))))&&(_compact))
							{
								initializer=simple_initializer();
							}
							else if ((tokenSet_95_.member(LA(1))) && (tokenSet_97_.member(LA(2)))) {
								initializer=declaration_initializer();
							}
							else
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							
						}
					}
					break;
				}
				case EOL:
				case IF:
				case UNLESS:
				case WHILE:
				case EOS:
				{
					{
						if (!(!_compact))
						  throw new SemanticException("!_compact");
						{
							switch ( LA(1) )
							{
							case IF:
							case UNLESS:
							case WHILE:
							{
								m=stmt_modifier();
								break;
							}
							case EOL:
							case EOS:
							{
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
						eos();
					}
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			if (0==inputState.guessing)
			{
				
						Declaration d = new Declaration(ToLexicalInfo(id));
						d.Name = id.getText();
						d.Type = tr;
						
						s = new DeclarationStatement(d.LexicalInfo);
						s.Declaration = d;
						s.Initializer = initializer;
						s.Modifier = m;
					
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "declaration_stmt");
				recover(ex,tokenSet_22_);
			}
			else
			{
				throw ex;
			}
		}
		return s;
	}
		public object VisitLocalVariableDeclaration(LocalVariableDeclaration lvd, object data)
		{
			ArrayList list = new ArrayList();
			for (int i = 0; i < lvd.Variables.Count; i++) {
				B.DeclarationStatement varDecl = new B.DeclarationStatement(GetLexicalInfo(lvd));
				varDecl.Declaration = new B.Declaration(GetLexicalInfo(lvd.Variables[i]), lvd.Variables[i].Name, ConvertTypeReference(lvd.GetTypeForVariable(i)));
				varDecl.Initializer = ConvertExpression(lvd.Variables[i].Initializer);
				list.Add(varDecl);
			}
			return list;
		}
		public override void OnDeclarationStatement(DeclarationStatement node)
		{
			CodeVariableDeclarationStatement var = new CodeVariableDeclarationStatement(ConvTypeRef(node.Declaration.Type),
			                                                                            node.Declaration.Name);
			if (node.Initializer != null) {
				_expression = null;
				node.Initializer.Accept(this);
				var.InitExpression = _expression;
			}
			_statements.Add(var);
		}
Example #19
0
 public override void OnDeclarationStatement(DeclarationStatement d)
 {
     WriteIndented();
     Visit(d.Declaration);
     if (null != d.Initializer)
     {
         WriteOperator(" = ");
         Visit(d.Initializer);
     }
     WriteLine();
 }
		public override void OnDeclarationStatement(DeclarationStatement node)
		{
			declarations.Add(node);
			base.OnDeclarationStatement(node);
		}
Example #21
0
        //throws RecognitionException, TokenStreamException
        protected DeclarationStatement declaration_stmt()
        {
            DeclarationStatement s;

            IToken  id = null;

                s = null;
                TypeReference tr = null;
                Expression initializer = null;
                StatementModifier m = null;

            try {      // for error handling
            id = LT(1);
            match(ID);
            match(AS);
            tr=type_reference();
            {
                switch ( LA(1) )
                {
                case ASSIGN:
                {
                    {
                        match(ASSIGN);
                        initializer=declaration_initializer();
                    }
                    break;
                }
                case EOF:
                case IF:
                case UNLESS:
                case WHILE:
                case EOS:
                case NEWLINE:
                {
                    {
                        {
                            switch ( LA(1) )
                            {
                            case IF:
                            case UNLESS:
                            case WHILE:
                            {
                                m=stmt_modifier();
                                break;
                            }
                            case EOF:
                            case EOS:
                            case NEWLINE:
                            {
                                break;
                            }
                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                             }
                        }
                        eos();
                    }
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            if (0==inputState.guessing)
            {

                        Declaration d = new Declaration(SourceLocationFactory.ToLexicalInfo(id));
                        d.Name = id.getText();
                        d.Type = tr;

                        s = new DeclarationStatement(d.LexicalInfo);
                        s.Declaration = d;
                        s.Initializer = initializer;
                        s.Modifier = m;

            }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_79_);
            }
            else
            {
                throw ex;
            }
            }
            return s;
        }
Example #22
0
        private IType GetDeclarationType(DeclarationStatement node)
        {
            if (null != node.Declaration.Type) return GetType(node.Declaration.Type);

            return InferDeclarationType(node);
        }
Example #23
0
	protected Statement  nested_function() //throws RecognitionException, TokenStreamException
{
		Statement stmt;
		
		IToken  def = null;
		IToken  id = null;
		
			stmt = null;
			BlockExpression be = null;
			Block body = null;
			TypeReference rt = null;
		
		
		try {      // for error handling
			def = LT(1);
			match(DEF);
			id = LT(1);
			match(ID);
			if (0==inputState.guessing)
			{
				
						be = new BlockExpression(ToLexicalInfo(id));
						body = be.Body;
					
			}
			{
				switch ( LA(1) )
				{
				case LPAREN:
				{
					match(LPAREN);
					parameter_declaration_list(be.Parameters);
					match(RPAREN);
					{
						switch ( LA(1) )
						{
						case AS:
						{
							match(AS);
							rt=type_reference();
							if (0==inputState.guessing)
							{
								be.ReturnType = rt;
							}
							break;
						}
						case COLON:
						{
							break;
						}
						default:
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						 }
					}
					break;
				}
				case COLON:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			compound_stmt(body);
			if (0==inputState.guessing)
			{
				
						string name = id.getText();
						stmt = new DeclarationStatement(
									ToLexicalInfo(def),
									new Declaration(
										ToLexicalInfo(id),
										name),
									be);
						be[BlockExpression.ClosureNameAnnotation] = name;
					
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "nested_function");
				recover(ex,tokenSet_84_);
			}
			else
			{
				throw ex;
			}
		}
		return stmt;
	}
Example #24
0
        public override void LeaveDeclarationStatement(DeclarationStatement node)
        {
            IType type = GetDeclarationType(node);

            AssertDeclarationName(node.Declaration);

            IEntity localInfo = DeclareLocal(node, node.Declaration.Name, type);
            if (null != node.Initializer)
            {
                IType itype = GetExpressionType(node.Initializer);
                AssertTypeCompatibility(node.Initializer, type, itype);

                if (TypeSystemServices.IsNullable(type) && !TypeSystemServices.IsNullable(itype))
                {
                    BindNullableInitializer(node, node.Initializer, type);
                }

                node.ReplaceBy(
                    new ExpressionStatement(
                        CodeBuilder.CreateAssignment(
                            node.LexicalInfo,
                            CodeBuilder.CreateReference(localInfo),
                            node.Initializer)));
            }
            else
            {
                node.ReplaceBy(
                    new ExpressionStatement(
                        CreateDefaultLocalInitializer(node, localInfo)));
            }
        }
Example #25
0
 private void EnsureDeclarationType(DeclarationStatement node)
 {
     var declaration = node.Declaration;
     if (declaration.Type != null) return;
     declaration.Type = CodeBuilder.CreateTypeReference(declaration.LexicalInfo, InferDeclarationType(node));
 }
Example #26
0
		override public object Clone()
		{
		
			DeclarationStatement clone = new DeclarationStatement();
			clone._lexicalInfo = _lexicalInfo;
			clone._endSourceLocation = _endSourceLocation;
			clone._documentation = _documentation;
			clone._isSynthetic = _isSynthetic;
			clone._entity = _entity;
			if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
			if (null != _modifier)
			{
				clone._modifier = _modifier.Clone() as StatementModifier;
				clone._modifier.InitializeParent(clone);
			}
			if (null != _declaration)
			{
				clone._declaration = _declaration.Clone() as Declaration;
				clone._declaration.InitializeParent(clone);
			}
			if (null != _initializer)
			{
				clone._initializer = _initializer.Clone() as Expression;
				clone._initializer.InitializeParent(clone);
			}
			return clone;


		}
Example #27
0
        private IType InferDeclarationType(DeclarationStatement node)
        {
            if (null == node.Initializer) return TypeSystemServices.ObjectType;

            // The boo syntax does not require this check because
            // there's no way to create an untyped declaration statement.
            // This is here to support languages that do allow untyped variable
            // declarations (unityscript is such an example).
            return MapNullToObject(GetConcreteExpressionType(node.Initializer));
        }
		public override void OnDeclarationStatement(DeclarationStatement node)
		{
			DeclarationFound(node.Declaration.Name, node.Declaration.Type, node.Initializer, node.LexicalInfo);
		}