public ResolveVisitor(BooResolver resolver)
		{
			this.resolver = resolver;
			this.callingClass = resolver.CallingClass;
			this.projectContent = resolver.ProjectContent;
			this.cu = resolver.CompilationUnit;
		}
            public override void OnYieldStatement(YieldStatement node)
            {
                noReturnStatement = false;

                IProjectContent pc         = context != null ? context.ProjectContent : ParserService.CurrentProjectContent;
                IReturnType     enumerable = new GetClassReturnType(pc, "System.Collections.Generic.IEnumerable", 1);

                // Prevent creating an infinite number of InferredReturnTypes in inferring cycles
                parentReturnType.expression = new NullLiteralExpression();
                IReturnType returnType;

                if (node.Expression == null)
                {
                    returnType = ConvertVisitor.GetDefaultReturnType(pc);
                }
                else
                {
                    returnType = new BooResolver().GetTypeOfExpression(node.Expression, context);
                }
                if (returnType != null)
                {
                    returnType.GetUnderlyingClass();                     // force to infer type
                }
                if (parentReturnType.expression == null)
                {
                    // inferrence cycle with parentReturnType
                    returnType = new GetClassReturnType(pc, "?", 0);
                }
                parentReturnType.expression = null;

                result = new ConstructedReturnType(enumerable, new IReturnType[] { returnType });
            }
Exemple #3
0
 public ResolveVisitor(BooResolver resolver)
 {
     this.resolver       = resolver;
     this.callingClass   = resolver.CallingClass;
     this.projectContent = resolver.ProjectContent;
     this.cu             = resolver.CompilationUnit;
 }
 public VariableListLookupVisitor(List <string> knownVariableNames, BooResolver resolver)
 {
     this.knownVariableNames = knownVariableNames;
     this.resolver           = resolver;
 }
 public VariableLookupVisitor(BooResolver resolver, string lookFor, bool acceptImplicit)
 {
     this.resolver       = resolver;
     this.lookFor        = lookFor;
     this.acceptImplicit = acceptImplicit;
 }
		public VariableListLookupVisitor(List<string> knownVariableNames, BooResolver resolver)
		{
			this.knownVariableNames = knownVariableNames;
			this.resolver = resolver;
		}
		public VariableLookupVisitor(BooResolver resolver, string lookFor, bool acceptImplicit)
		{
			this.resolver = resolver;
			this.lookFor = lookFor;
			this.acceptImplicit = acceptImplicit;
		}
		public override void OnArrayLiteralExpression(ArrayLiteralExpression node)
		{
			BooResolver resolver = new BooResolver();
			IReturnType createType = resolver.GetTypeOfExpression(node, null);
			if (createType == null)
				createType = pc.SystemTypes.Object;
			CodeExpression[] initializers = new CodeExpression[node.Items.Count];
			for (int i = 0; i < initializers.Length; i++) {
				_expression = null;
				node.Items[i].Accept(this);
				initializers[i] = _expression;
			}
			_expression = new CodeArrayCreateExpression(createType.FullyQualifiedName, initializers);
			_expression.UserData["unknownType"] = node.Type != null;
		}
			public override void OnYieldStatement(YieldStatement node)
			{
				noReturnStatement = false;
				
				IProjectContent pc = context != null ? context.ProjectContent : ParserService.CurrentProjectContent;
				IReturnType enumerable = new GetClassReturnType(pc, "System.Collections.Generic.IEnumerable", 1);
				
				// Prevent creating an infinite number of InferredReturnTypes in inferring cycles
				parentReturnType.expression = new NullLiteralExpression();
				IReturnType returnType;
				if (node.Expression == null)
					returnType = ConvertVisitor.GetDefaultReturnType(pc);
				else
					returnType = new BooResolver().GetTypeOfExpression(node.Expression, context);
				if (returnType != null) {
					returnType.GetUnderlyingClass(); // force to infer type
				}
				if (parentReturnType.expression == null) {
					// inferrence cycle with parentReturnType
					returnType = new GetClassReturnType(pc, "?", 0);
				}
				parentReturnType.expression = null;
				
				result = new ConstructedReturnType(enumerable, new IReturnType[] { returnType });
			}