Exemplo n.º 1
0
        public ModuleDefinition(LexicalScope /*!*/ definedScope, ConstantVariable /*!*/ qualifiedName, Body /*!*/ body, SourceSpan location)
            : base(definedScope, body, location)
        {
            ContractUtils.RequiresNotNull(qualifiedName, "qualifiedName");

            _qualifiedName = qualifiedName;
        }
Exemplo n.º 2
0
        public ClassDefinition(LexicalScope /*!*/ definedScope, ConstantVariable /*!*/ name, Expression superClass, Body /*!*/ body, SourceSpan location)
            : base(definedScope, name, body, location)
        {
            ContractUtils.RequiresNotNull(name, "name");

            _superClass = superClass;
        }
Exemplo n.º 3
0
        public ClassDefinition(LexicalScope/*!*/ definedScope, ConstantVariable/*!*/ name, Expression superClass, Body/*!*/ body, SourceSpan location)
            : base(definedScope, name, body, location)
        {
            ContractUtils.RequiresNotNull(name, "name");

            _superClass = superClass;
        }
Exemplo n.º 4
0
        public ModuleDefinition(LexicalScope/*!*/ definedScope, ConstantVariable/*!*/ qualifiedName, Body/*!*/ body, SourceSpan location)
            : base(definedScope, body, location)
        {
            ContractUtils.RequiresNotNull(qualifiedName, "qualifiedName");

            _qualifiedName = qualifiedName;
        }
Exemplo n.º 5
0
 internal protected virtual void Walk(ConstantVariable /*!*/ node)
 {
     if (Enter(node))
     {
         if (node.Qualifier != null)
         {
             node.Qualifier.Walk(this);
         }
     }
     Exit(node);
 }
Exemplo n.º 6
0
        private MSA.Expression /*!*/ TransformRead(AstGenerator /*!*/ gen, int opKind)
        {
            ConstantVariable constantQualifier = _qualifier as ConstantVariable;

            if (constantQualifier != null)
            {
                ConstantVariable constant;
                List <string>    names = new List <string>();
                names.Add(Name);
                do
                {
                    names.Add(constantQualifier.Name);
                    constant          = constantQualifier;
                    constantQualifier = constantQualifier.Qualifier as ConstantVariable;
                } while (constantQualifier != null);

                if (constant.Qualifier != null)
                {
                    // {expr}::A::B
                    return(constant.MakeExpressionQualifiedRead(gen, opKind, names.ToReverseArray()));
                }
                else
                {
                    // A::B
                    return(MakeCachedRead(gen, opKind, constant.IsGlobal, true, Ast.Constant(names.ToReverseArray())));
                }
            }
            else if (_qualifier != null)
            {
                // {expr}::A
                return(MakeExpressionQualifiedRead(gen, opKind, new[] { Name }));
            }
            else
            {
                // A
                // ::A
                return(MakeCachedRead(gen, opKind, IsGlobal, false, Ast.Constant(Name)));
            }
        }
Exemplo n.º 7
0
        /*!*/
        private static string BuildName(string prefix, ConstantVariable/*!*/ constant)
        {
            var reversed = new List<string>();
            ConstantVariable constantQualifier;
            while (true) {
                reversed.Add(constant.Name);
                constantQualifier = constant.Qualifier as ConstantVariable;
                if (constantQualifier == null) {
                    break;
                }
                constant = constantQualifier;
            }

            // A::B
            // ::A::B
            // <expr>::A::B
            if (!constant.IsGlobal) {
                if (constant.IsBound) {
                    reversed.Add("<object>");
                } else if (prefix != null) {
                    reversed.Add(prefix);
                }
            }

            return String.Join("::", Enumerable.Reverse(reversed));
        }
Exemplo n.º 8
0
 protected ModuleDefinition(LexicalScope/*!*/ definedScope, Body/*!*/ body, SourceSpan location)
     : base(definedScope, body, location) {
     _qualifiedName = null;
 }
Exemplo n.º 9
0
 public virtual void Exit(ConstantVariable/*!*/ node) { }
Exemplo n.º 10
0
 public virtual bool Enter(ConstantVariable/*!*/ node) { return true; }
Exemplo n.º 11
0
		/// <summary>
		/// Gets the fully qualified name (e.g. System.Windows.Forms.Form)
		/// </summary>
		public static string GetQualifiedName(ConstantVariable variable)
		{
			StringBuilder name = new StringBuilder();
			while (variable != null) {
				name.Insert(0, variable.Name);
				variable = variable.Qualifier as ConstantVariable;
				if (variable != null) {
					name.Insert(0, '.');
				}
			}
			return name.ToString();
		}
Exemplo n.º 12
0
 public virtual void Exit(ConstantVariable /*!*/ node)
 {
 }
Exemplo n.º 13
0
 public virtual bool Enter(ConstantVariable /*!*/ node)
 {
     return(true);
 }
Exemplo n.º 14
0
		string GetFullyQualifiedName(ConstantVariable variable)
		{
			StringBuilder name = new StringBuilder();
			bool firstName = true;
			while (variable != null) {
				if (!firstName) {
					name.Insert(0, '.');
				}
				name.Insert(0, variable.Name);
				variable = variable.Qualifier as ConstantVariable;
				firstName = false;
			}
			return name.ToString();
		}
Exemplo n.º 15
0
 protected ModuleDefinition(LexicalScope /*!*/ definedScope, Body /*!*/ body, SourceSpan location)
     : base(definedScope, body, location)
 {
     _qualifiedName = null;
 }