public JsVariableField(JsFieldType fieldType, string name, FieldAttributes fieldAttributes, object value) { m_referenceTable = new HashSet <IJsNameReference>(); m_declarationTable = new HashSet <IJsNameDeclaration>(); Name = name; Attributes = fieldAttributes; FieldValue = value; SetFieldsBasedOnType(fieldType); }
public JsVariableField(JsFieldType fieldType, string name, FieldAttributes fieldAttributes, object value) { m_referenceTable = new HashSet<IJsNameReference>(); m_declarationTable = new HashSet<IJsNameDeclaration>(); Name = name; Attributes = fieldAttributes; FieldValue = value; SetFieldsBasedOnType(fieldType); }
private void SetFieldsBasedOnType(JsFieldType fieldType) { FieldType = fieldType; switch (FieldType) { case JsFieldType.Argument: case JsFieldType.CatchError: IsDeclared = true; CanCrunch = true; break; case JsFieldType.Arguments: IsDeclared = false; CanCrunch = false; break; case JsFieldType.Global: CanCrunch = false; break; case JsFieldType.Local: CanCrunch = true; break; case JsFieldType.Predefined: IsDeclared = false; CanCrunch = false; break; case JsFieldType.WithField: CanCrunch = false; break; case JsFieldType.GhostCatch: CanCrunch = true; IsPlaceholder = true; break; case JsFieldType.GhostFunction: CanCrunch = OuterField == null ? true : OuterField.CanCrunch; IsFunction = true; IsPlaceholder = true; break; case JsFieldType.UndefinedGlobal: CanCrunch = false; break; default: // shouldn't get here throw new ArgumentException("Invalid field type", "fieldType"); } }
internal JsVariableField(JsFieldType fieldType, JsVariableField outerField) { if (outerField == null) { throw new ArgumentNullException("outerField"); } m_referenceTable = new HashSet <IJsNameReference>(); m_declarationTable = new HashSet <IJsNameDeclaration>(); // set values based on the outer field OuterField = outerField; Name = outerField.Name; Attributes = outerField.Attributes; FieldValue = outerField.FieldValue; IsGenerated = outerField.IsGenerated; // and set some other fields on our object based on the type we are SetFieldsBasedOnType(fieldType); }
internal JsVariableField(JsFieldType fieldType, JsVariableField outerField) { if (outerField == null) { throw new ArgumentNullException("outerField"); } m_referenceTable = new HashSet<IJsNameReference>(); m_declarationTable = new HashSet<IJsNameDeclaration>(); // set values based on the outer field OuterField = outerField; Name = outerField.Name; Attributes = outerField.Attributes; FieldValue = outerField.FieldValue; IsGenerated = outerField.IsGenerated; // and set some other fields on our object based on the type we are SetFieldsBasedOnType(fieldType); }
private JsVariableField ResolveFromCollection(string name, HashSet<string> collection, JsFieldType fieldType, bool isFunction) { if (collection.Contains(name)) { var variableField = new JsVariableField(fieldType, name, 0, null); variableField.IsFunction = isFunction; return AddField(variableField); } return null; }
private JsVariableField ResolveFromCollection(string name, HashSet <string> collection, JsFieldType fieldType, bool isFunction) { if (collection.Contains(name)) { var variableField = new JsVariableField(fieldType, name, 0, null); variableField.IsFunction = isFunction; return(AddField(variableField)); } return(null); }