コード例 #1
0
		public ResolveVisitor(BooResolver resolver)
		{
			this.resolver = resolver;
			this.callingClass = resolver.CallingClass;
			this.projectContent = resolver.ProjectContent;
			this.cu = resolver.CompilationUnit;
		}
コード例 #2
0
            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 });
            }
コード例 #3
0
 public ResolveVisitor(BooResolver resolver)
 {
     this.resolver       = resolver;
     this.callingClass   = resolver.CallingClass;
     this.projectContent = resolver.ProjectContent;
     this.cu             = resolver.CompilationUnit;
 }
コード例 #4
0
 public VariableListLookupVisitor(List <string> knownVariableNames, BooResolver resolver)
 {
     this.knownVariableNames = knownVariableNames;
     this.resolver           = resolver;
 }
コード例 #5
0
 public VariableLookupVisitor(BooResolver resolver, string lookFor, bool acceptImplicit)
 {
     this.resolver       = resolver;
     this.lookFor        = lookFor;
     this.acceptImplicit = acceptImplicit;
 }
コード例 #6
0
		public VariableListLookupVisitor(List<string> knownVariableNames, BooResolver resolver)
		{
			this.knownVariableNames = knownVariableNames;
			this.resolver = resolver;
		}
コード例 #7
0
		public VariableLookupVisitor(BooResolver resolver, string lookFor, bool acceptImplicit)
		{
			this.resolver = resolver;
			this.lookFor = lookFor;
			this.acceptImplicit = acceptImplicit;
		}
コード例 #8
0
		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;
		}
コード例 #9
0
			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 });
			}