/// <summary> /// Add at runtime a constant to a type /// </summary> /// <param name="typedesc">Type to modify</param> /// <param name="attributes">New const attributes</param> /// <param name="const_name">Const name</param> /// <param name="value">Const value</param> /// <remarks>Used by PDO_MYSQL</remarks> public void AddConstantToType(DTypeDesc typedesc, PhpMemberAttributes attributes, string const_name, object value) { Debug.Assert(typedesc != null); VariableName name = new VariableName(const_name); DConstantDesc const_desc = new DConstantDesc(typedesc, attributes, value); if (!typedesc.Constants.ContainsKey(name)) { typedesc.Constants.Add(name, const_desc); } }
/// <summary> /// Returns 'FieldInfo' representing field in AutoGlobals for given global variable name. /// </summary> internal static FieldInfo GetFieldForVariable(VariableName name) { switch (name.ToString()) { case AutoGlobals.GlobalsName: return(Fields.AutoGlobals.Globals); case AutoGlobals.CanvasName: return(Fields.AutoGlobals.Canvas); case AutoGlobals.AddrName: return(Fields.AutoGlobals.Addr); default: return(null); } }
public void Set(VariableName varName, bool isPhpReference) { Entry entry; if (variables.TryGetValue(varName, out entry)) { entry.IsDirectlyUsed = true; if (allRef || isPhpReference) { entry.IsPhpReference = true; } } else if (!varName.IsAutoGlobal) { variables.Add(varName, new Entry(varName, allRef || isPhpReference)); } }
public bool AddParameter(VariableName paramName, bool isPassedByRef) { Entry entry; if (variables.TryGetValue(paramName, out entry)) { // parameter with the same name specified twice if (entry.IsParameter) { //return false; } else { Debug.Fail(null); return(true); } } // add variable entry variables[paramName] = new Entry(paramName, isPassedByRef, true); // parameter can be specified twice in PHP, the last one is used return(true); }
/// <summary> /// Returns 'FieldInfo' representing field in AutoGlobals for given global variable name. /// </summary> internal static FieldInfo GetFieldForVariable(VariableName name) { switch (name.ToString()) { case AutoGlobals.CookieName: return(Fields.AutoGlobals.Cookie); case AutoGlobals.EnvName: return(Fields.AutoGlobals.Env); case AutoGlobals.FilesName: return(Fields.AutoGlobals.Files); case AutoGlobals.GetName: return(Fields.AutoGlobals.Get); case AutoGlobals.GlobalsName: return(Fields.AutoGlobals.Globals); case AutoGlobals.PostName: return(Fields.AutoGlobals.Post); case AutoGlobals.RequestName: return(Fields.AutoGlobals.Request); case AutoGlobals.ServerName: return(Fields.AutoGlobals.Server); case AutoGlobals.SessionName: return(Fields.AutoGlobals.Session); case AutoGlobals.HttpRawPostDataName: return(Fields.AutoGlobals.HttpRawPostData); default: return(null); } }
public Entry(VariableName varName, bool isPhpReference) : this(varName, isPhpReference, false) { }
public bool Contains(VariableName name) { return(variables.ContainsKey(name)); }
public Entry this[VariableName name] { get { return(variables[name]); } }