Esempio n. 1
0
		public virtual void VisitVariableReferenceExpression(VariableReferenceExpression expression)
		{
			VisitNode(expression.Identifier);
			VisitCommonExpNodes(expression);
		}
Esempio n. 2
0
		public override bool VisitVariableReferenceExpression(VariableReferenceExpression varRef)
		{
			if (varRef.Identifier.Type == IdentifierType.Local)
			{
				String name = varRef.Identifier.Name;
				ISymbolTable table = varRef.SymbolTable;

				// It might be a variable or might be something else. 
				// First of all, let's see whether it is a var

				bool isDefinedAsVar = false;

				isDefinedAsVar = varRef.SymbolTable.IsDefined(name);
				
				if (!isDefinedAsVar)
				{
					if (table.ScopeType == ScopeType.Block || table.ScopeType == ScopeType.Compound)
					{
						isDefinedAsVar = table.IsDefinedInParent(name);
					}
				}

				if (!isDefinedAsVar)
				{
					// Ok, this might be two things now: 
					// an undeclared variable, a type ref or a member access... Let's check the type graph

					TypeDefinition typeDef = varRef.SymbolTable.CurrentTypeDefinition;

					System.Diagnostics.Debug.Assert( typeDef != null );

					if (typeDef.HasInstanceMember(name) || typeDef.HasStaticMember(name))
					{
						// Wow! Finally

						// TODO: Replace node by MemberAccess or method invocation, depending on the case
					}
					else 
					{
						NamespaceGraph nsGraph = table.TypeGraphView.GetNamespace( name );

						if (nsGraph == null)
						{
							TypeDefinition typedef = table.TypeGraphView.GetType( name );

							if (typedef == null)
							{
								errorReport.Error( "TODOFILENAME", varRef.Position, "'{0}' undeclared identifier", name );
							}
						}
					}
				}
			}

			return base.VisitVariableReferenceExpression(varRef);
		}
 public void AddVarRef(VariableReferenceExpression vre)
 {
     varRefs.Add(vre);
 }
Esempio n. 4
0
	public VariableReferenceExpression  varref() //throws RecognitionException, TokenStreamException
{
		VariableReferenceExpression vre;
		
		Identifier ident = null; vre = null;
		
		ident=name();
		if (0==inputState.guessing)
		{
			vre = new VariableReferenceExpression(ident);
		}
		return vre;
	}
Esempio n. 5
0
		public override void VisitVariableReferenceExpression(VariableReferenceExpression expression)
		{
			nodeStack.Push( CurrentNode.Nodes.Add("VariableReferenceExpression - " + expression.Identifier.Name));
			CurrentNode.Tag = expression;

			base.VisitVariableReferenceExpression(expression);

			nodeStack.Pop();
		}