mirror of
https://github.com/ZuneDev/ZuneShell.dll.git
synced 2026-07-27 13:11:51 -07:00
Removed unnecessary casts
This commit is contained in:
@@ -17,7 +17,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
public static TypeRestriction NotVoid;
|
||||
|
||||
public TypeRestriction(TypeSchema primary)
|
||||
: this(primary, (TypeSchema)null)
|
||||
: this(primary, null)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
|
||||
public static void InitializeStatics()
|
||||
{
|
||||
TypeRestriction.None = new TypeRestriction((TypeSchema)null, (TypeSchema)null, true);
|
||||
TypeRestriction.NotVoid = new TypeRestriction((TypeSchema)VoidSchema.Type, (TypeSchema)null, false);
|
||||
TypeRestriction.None = new TypeRestriction(null, null, true);
|
||||
TypeRestriction.NotVoid = new TypeRestriction(VoidSchema.Type, null, false);
|
||||
}
|
||||
|
||||
public TypeSchema Primary => this._primary;
|
||||
@@ -56,8 +56,8 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
string str2 = this._primary.Name;
|
||||
if (str1 == str2)
|
||||
{
|
||||
str1 = str1 + " (" + (object)checkType.Owner + ")";
|
||||
str2 = str2 + " (" + (object)this._primary.Owner + ")";
|
||||
str1 = str1 + " (" + checkType.Owner + ")";
|
||||
str2 = str2 + " (" + _primary.Owner + ")";
|
||||
}
|
||||
subject.ReportError(errorMessage, str1, str2);
|
||||
return false;
|
||||
|
||||
@@ -59,14 +59,14 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
string param2,
|
||||
string param3)
|
||||
{
|
||||
this.ReportError(string.Format(error, (object)param0, (object)param1, (object)param2, (object)param3));
|
||||
this.ReportError(string.Format(error, param0, param1, param2, param3));
|
||||
}
|
||||
|
||||
public void ReportError(string error, string param0, string param1, string param2) => this.ReportError(string.Format(error, (object)param0, (object)param1, (object)param2));
|
||||
public void ReportError(string error, string param0, string param1, string param2) => this.ReportError(string.Format(error, param0, param1, param2));
|
||||
|
||||
public void ReportError(string error, string param0, string param1) => this.ReportError(string.Format(error, (object)param0, (object)param1));
|
||||
public void ReportError(string error, string param0, string param1) => this.ReportError(string.Format(error, param0, param1));
|
||||
|
||||
public void ReportError(string error, string param0) => this.ReportError(string.Format(error, (object)param0));
|
||||
public void ReportError(string error, string param0) => this.ReportError(string.Format(error, param0));
|
||||
|
||||
public void ReportError(string error)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
this._currentValidationPass = currentPass;
|
||||
if (this._currentValidationPass == LoadPass.DeclareTypes)
|
||||
{
|
||||
ValidateContext context = new ValidateContext((ValidateClass)null, (MarkupTypeSchema)null, this._currentValidationPass);
|
||||
ValidateContext context = new ValidateContext(null, null, this._currentValidationPass);
|
||||
this.Validate(TypeRestriction.None, context);
|
||||
this._aliasName = this.GetInlinePropertyValueNoValidate("Name");
|
||||
string propertyValueNoValidate = this.GetInlinePropertyValueNoValidate("Type");
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
private string _previewName;
|
||||
private static Map<string, TypeSchema> s_classReservedSymbols = new Map<string, TypeSchema>(1);
|
||||
|
||||
public static void InitializeStatics() => ValidateClass.s_classReservedSymbols["Class"] = (TypeSchema)ClassStateSchema.Type;
|
||||
public static void InitializeStatics() => ValidateClass.s_classReservedSymbols["Class"] = ClassStateSchema.Type;
|
||||
|
||||
public ValidateClass(
|
||||
SourceMarkupLoader owner,
|
||||
@@ -94,9 +94,9 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
{
|
||||
if (this.Owner.IsTypeNameTaken(this.PreviewName))
|
||||
this.ReportError("Type '{0}' was specified more than once", this.PreviewName);
|
||||
this._typeExport = MarkupTypeSchema.Build(this.ObjectType, (MarkupLoadResult)this.Owner.LoadResultTarget, this.PreviewName);
|
||||
this._typeExport = MarkupTypeSchema.Build(this.ObjectType, Owner.LoadResultTarget, this.PreviewName);
|
||||
this._typeExportIndex = this.Owner.RegisterExportedType(this._typeExport);
|
||||
this._typeExport.LoadData = (object)this;
|
||||
this._typeExport.LoadData = this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
if (!this.HasErrors)
|
||||
{
|
||||
bool flag = false;
|
||||
for (TypeSchema typeSchema = (TypeSchema)foundType; typeSchema is MarkupTypeSchema; typeSchema = typeSchema.Base)
|
||||
for (TypeSchema typeSchema = foundType; typeSchema is MarkupTypeSchema; typeSchema = typeSchema.Base)
|
||||
{
|
||||
if (typeSchema == this._typeExport)
|
||||
{
|
||||
@@ -171,7 +171,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
ValidateProperty property2 = this.FindProperty("Shared", true);
|
||||
if (property2 != null)
|
||||
{
|
||||
property2.Validate((ValidateObjectTag)this, context);
|
||||
property2.Validate(this, context);
|
||||
if (property2.HasErrors)
|
||||
this.MarkHasErrors();
|
||||
else if (property2.IsFromStringValue)
|
||||
@@ -219,7 +219,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
else if (this._typeExport != null)
|
||||
{
|
||||
MarkupPropertySchema propertyExport = MarkupPropertySchema.Build(this.ObjectType, this._typeExport, propertyValueNoValidate, next.ObjectType);
|
||||
properties[length2] = (PropertySchema)propertyExport;
|
||||
properties[length2] = propertyExport;
|
||||
++length2;
|
||||
next.PropertySchemaExport = propertyExport;
|
||||
propertyExport.SetRequiredForCreation(next.PropertyIsRequiredForCreation);
|
||||
@@ -230,7 +230,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
if (length2 != properties.Length)
|
||||
{
|
||||
PropertySchema[] propertySchemaArray = new PropertySchema[length2];
|
||||
Array.Copy((Array)properties, (Array)propertySchemaArray, length2);
|
||||
Array.Copy(properties, propertySchemaArray, length2);
|
||||
properties = propertySchemaArray;
|
||||
}
|
||||
if (this._typeExport != null)
|
||||
@@ -296,7 +296,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
return;
|
||||
MethodSchema[] virtualMethods = new MethodSchema[this._foundVirtualMethods.Count];
|
||||
for (int index = 0; index < virtualMethods.Length; ++index)
|
||||
virtualMethods[index] = (MethodSchema)this._foundVirtualMethods[index];
|
||||
virtualMethods[index] = this._foundVirtualMethods[index];
|
||||
this._typeExport.SetVirtualMethodList(virtualMethods);
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
foreach (SymbolRecord symbolRecord in typeExport.InheritableSymbolsTable)
|
||||
{
|
||||
if (symbolRecord.SymbolOrigin == SymbolOrigin.Locals || symbolRecord.SymbolOrigin == SymbolOrigin.Properties)
|
||||
map[(object)symbolRecord.Name] = (object)null;
|
||||
map[symbolRecord.Name] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -377,7 +377,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
|
||||
public Vector<ValidateCode> ActionList => this._actionList;
|
||||
|
||||
public ArrayList MethodList => this._foundMethods == null ? (ArrayList)null : this._foundMethods.Methods;
|
||||
public ArrayList MethodList => this._foundMethods == null ? null : this._foundMethods.Methods;
|
||||
|
||||
public string PreviewName => this._previewName;
|
||||
|
||||
@@ -387,6 +387,6 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
|
||||
public ValidateProperty FoundPropertiesValidateProperty => this._foundPropertiesValidateProperty;
|
||||
|
||||
public override string ToString() => this.Name != null ? string.Format("ClassTag : {0}", (object)this.Name) : "Not validated :" + this._previewName;
|
||||
public override string ToString() => this.Name != null ? string.Format("ClassTag : {0}", Name) : "Not validated :" + this._previewName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
ValidateStatementReturn returnStatement = this._returnStatements[index];
|
||||
if (returnStatement.HasErrors)
|
||||
return;
|
||||
TypeSchema type = (TypeSchema)VoidSchema.Type;
|
||||
TypeSchema type = VoidSchema.Type;
|
||||
ValidateExpression expression = returnStatement.Expression;
|
||||
if (expression != null)
|
||||
type = expression.ObjectType;
|
||||
@@ -65,15 +65,15 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
}
|
||||
}
|
||||
else
|
||||
this._returnType = (TypeSchema)VoidSchema.Type;
|
||||
this._returnType = VoidSchema.Type;
|
||||
string errorMessage = "'{0}' cannot be used in this context (expecting types compatible with '{1}')";
|
||||
if (typeRestriction.Primary == VoidSchema.Type && typeRestriction.Secondary == null)
|
||||
errorMessage = "Return values are not supported for this code block (currently returning '{0}')";
|
||||
else if (this._returnStatements.Count == 0)
|
||||
errorMessage = "Code block must have at least one return statement of type '{0}'";
|
||||
if (!typeRestriction.Check((ValidateObject)this, errorMessage, this._returnType))
|
||||
if (!typeRestriction.Check(this, errorMessage, this._returnType))
|
||||
return;
|
||||
ValidateStatementReturn validateStatementReturn = (ValidateStatementReturn)null;
|
||||
ValidateStatementReturn validateStatementReturn = null;
|
||||
ValidateStatement validateStatement = this._statementCompound.StatementList;
|
||||
if (validateStatement != null)
|
||||
{
|
||||
@@ -152,7 +152,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
public ValidateCode Next
|
||||
{
|
||||
get => (ValidateCode)base.Next;
|
||||
set => base.Next = (ValidateObject)value;
|
||||
set => base.Next = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
out ExpressionRestriction expressionRestriction,
|
||||
out TypeSchema baseTypeOrigin)
|
||||
{
|
||||
baseTypeOrigin = (TypeSchema)null;
|
||||
baseTypeOrigin = null;
|
||||
TypeSchema type = this.ResolveSymbol(this._symbolTable, name, out origin, out expressionRestriction);
|
||||
if (type == null && searchBaseTypes)
|
||||
{
|
||||
@@ -104,7 +104,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
type = this.ResolveSymbol(markupTypeSchema.InheritableSymbolsTable, name, out origin, out expressionRestriction);
|
||||
if (type != null)
|
||||
{
|
||||
baseTypeOrigin = (TypeSchema)markupTypeSchema;
|
||||
baseTypeOrigin = markupTypeSchema;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
}
|
||||
if (type == null && name == "this" && this._owner.ObjectType == ClassSchema.Type)
|
||||
{
|
||||
type = (TypeSchema)this._owner.TypeExport;
|
||||
type = _owner.TypeExport;
|
||||
origin = SymbolOrigin.Reserved;
|
||||
expressionRestriction = ExpressionRestriction.ReadOnly;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
}
|
||||
origin = SymbolOrigin.None;
|
||||
expressionRestriction = ExpressionRestriction.None;
|
||||
return (TypeSchema)null;
|
||||
return null;
|
||||
}
|
||||
|
||||
private TypeSchema ResolveSymbol(
|
||||
@@ -185,7 +185,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
}
|
||||
origin = SymbolOrigin.None;
|
||||
expressionRestriction = ExpressionRestriction.None;
|
||||
return (TypeSchema)null;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void DeclareReservedSymbols(Map<string, TypeSchema> reservedSymbols)
|
||||
@@ -216,7 +216,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
string name3 = name2 + "Instance";
|
||||
typeSchema1 = MarkupSystem.UIXGlobal.FindType(name3);
|
||||
if (typeSchema1 == null)
|
||||
result = Result.Fail(string.Format("Element '{0}' has no properties that can be changed dynamically and therefore cannot be named", (object)name2));
|
||||
result = Result.Fail(string.Format("Element '{0}' has no properties that can be changed dynamically and therefore cannot be named", name2));
|
||||
else
|
||||
this._owner.Owner.TrackImportedType(typeSchema1);
|
||||
}
|
||||
@@ -230,7 +230,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
if (this._currentScope == SymbolOrigin.Properties && origin == SymbolOrigin.Properties)
|
||||
{
|
||||
if (!typeSchema2.IsAssignableFrom(typeSchema1))
|
||||
result = Result.Fail(string.Format("Property '{0}' exists in base class '{1}' with type '{2}' and type override '{3}' does not match", (object)name1, (object)baseTypeOrigin.Name, (object)typeSchema2.Name, (object)typeSchema1.Name));
|
||||
result = Result.Fail(string.Format("Property '{0}' exists in base class '{1}' with type '{2}' and type override '{3}' does not match", name1, baseTypeOrigin.Name, typeSchema2.Name, typeSchema1.Name));
|
||||
else if (objectTag.PropertyOverrideCriteria != null)
|
||||
{
|
||||
MarkupPropertySchema propertyDeep = (MarkupPropertySchema)this._baseType.FindPropertyDeep(objectTag.Name);
|
||||
@@ -240,20 +240,20 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
else if (this._currentScope != SymbolOrigin.Content || origin != SymbolOrigin.Content)
|
||||
{
|
||||
if (this._currentScope == origin)
|
||||
result = Result.Fail("Name \"{0}\" (also defined in base class '{1}') cannot be overridden (tried to override {2}, but can only override Properties and Content)", (object)name1, (object)baseTypeOrigin.Name, (object)origin.ToString());
|
||||
result = Result.Fail("Name \"{0}\" (also defined in base class '{1}') cannot be overridden (tried to override {2}, but can only override Properties and Content)", name1, baseTypeOrigin.Name, origin.ToString());
|
||||
else
|
||||
result = Result.Fail(string.Format("Name \"{0}\" (located in {1}) cannot override the same name within base class '{2}' (located in {3}) since overrides cannot cross section types", (object)name1, (object)this._currentScope.ToString(), (object)baseTypeOrigin.Name, (object)origin.ToString()));
|
||||
result = Result.Fail(string.Format("Name \"{0}\" (located in {1}) cannot override the same name within base class '{2}' (located in {3}) since overrides cannot cross section types", name1, this._currentScope.ToString(), baseTypeOrigin.Name, origin.ToString()));
|
||||
}
|
||||
}
|
||||
else if (origin != SymbolOrigin.Reserved)
|
||||
result = Result.Fail("Name \"{0}\" is already in use (type '{1}') located in '{2}'", (object)name1, (object)typeSchema2.Name, (object)origin.ToString());
|
||||
result = Result.Fail("Name \"{0}\" is already in use (type '{1}') located in '{2}'", name1, typeSchema2.Name, origin.ToString());
|
||||
}
|
||||
if (!result.Failed)
|
||||
{
|
||||
if (this.IsNameReserved(name1))
|
||||
result = Result.Fail("Name \"{0}\" is reserved and cannot be used.", (object)name1);
|
||||
result = Result.Fail("Name \"{0}\" is reserved and cannot be used.", name1);
|
||||
else if (!ValidateContext.IsValidSymbolName(name1))
|
||||
result = Result.Fail("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", (object)name1);
|
||||
result = Result.Fail("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", name1);
|
||||
}
|
||||
if (!result.Failed && typeSchema1 != null)
|
||||
this._symbolTable.Add(new SymbolRecord()
|
||||
@@ -360,7 +360,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
foreach (SymbolRecord methodParameterRecord in this._methodParameterRecords)
|
||||
this._symbolTable.Remove(methodParameterRecord);
|
||||
this._methodParameterRecords.Clear();
|
||||
this._currentMethod = (ValidateMethod)null;
|
||||
this._currentMethod = null;
|
||||
}
|
||||
|
||||
public Result NotifyMethodFound(string name)
|
||||
@@ -371,7 +371,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
this._symbolTable.Add(new SymbolRecord()
|
||||
{
|
||||
Name = name,
|
||||
Type = (TypeSchema)null,
|
||||
Type = null,
|
||||
SymbolOrigin = SymbolOrigin.Methods
|
||||
});
|
||||
return Result.Success;
|
||||
@@ -409,27 +409,27 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
SymbolOrigin origin;
|
||||
TypeSchema typeSchema = this.ResolveSymbol(name, out origin, out ExpressionRestriction _);
|
||||
if (typeSchema != null)
|
||||
return Result.Fail("Name \"{0}\" is already in use (type '{1}') located in '{2}'", (object)name, (object)typeSchema.Name, (object)origin.ToString());
|
||||
return Result.Fail("Name \"{0}\" is already in use (type '{1}') located in '{2}'", name, typeSchema.Name, origin.ToString());
|
||||
if (!bypassReservedNameCheck)
|
||||
{
|
||||
if (this.IsNameReserved(name))
|
||||
return Result.Fail("Name \"{0}\" is reserved and cannot be used.", (object)name);
|
||||
return Result.Fail("Name \"{0}\" is reserved and cannot be used.", name);
|
||||
if (!ValidateContext.IsValidSymbolName(name))
|
||||
return Result.Fail("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", (object)name);
|
||||
return Result.Fail("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", name);
|
||||
}
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public void NotifyScopedLocalFrameEnter(ValidateStatementLoop statementLoop)
|
||||
{
|
||||
this._scopedLocalFrameStack.Add((Vector<SymbolRecord>)null);
|
||||
this._scopedLocalFrameStack.Add(null);
|
||||
if (statementLoop == null)
|
||||
return;
|
||||
this._loopFramesStack.Push(this._scopedLocalFrameStack.Count);
|
||||
this._loopStatementStack.Push(statementLoop);
|
||||
}
|
||||
|
||||
public void NotifyScopedLocalFrameEnter() => this.NotifyScopedLocalFrameEnter((ValidateStatementLoop)null);
|
||||
public void NotifyScopedLocalFrameEnter() => this.NotifyScopedLocalFrameEnter(null);
|
||||
|
||||
public Result NotifyScopedLocal(string name, TypeSchema type) => this.NotifyScopedLocal(name, type, false, SymbolOrigin.ScopedLocal);
|
||||
|
||||
@@ -467,7 +467,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
}
|
||||
Vector<SymbolRecord> scopedLocalFrame = this._scopedLocalFrameStack[this._scopedLocalFrameStack.Count - 1];
|
||||
this._scopedLocalFrameStack.RemoveAt(this._scopedLocalFrameStack.Count - 1);
|
||||
Vector<int> vector = (Vector<int>)null;
|
||||
Vector<int> vector = null;
|
||||
if (scopedLocalFrame != null)
|
||||
{
|
||||
vector = new Vector<int>();
|
||||
@@ -479,12 +479,12 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
vector.Add(num);
|
||||
}
|
||||
}
|
||||
return vector == null || vector.Count <= 0 ? (Vector<int>)null : vector;
|
||||
return vector == null || vector.Count <= 0 ? null : vector;
|
||||
}
|
||||
|
||||
private Vector<int> GetImmediateFrameUnwindList(SourceMarkupLoader owner, bool stopAtLoop)
|
||||
{
|
||||
Vector<int> vector = (Vector<int>)null;
|
||||
Vector<int> vector = null;
|
||||
int num1 = stopAtLoop ? this._loopFramesStack.Peek() : 0;
|
||||
for (int index = this._scopedLocalFrameStack.Count - 1; index >= num1; --index)
|
||||
{
|
||||
@@ -501,14 +501,14 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
}
|
||||
}
|
||||
}
|
||||
return vector == null || vector.Count <= 0 ? (Vector<int>)null : vector;
|
||||
return vector == null || vector.Count <= 0 ? null : vector;
|
||||
}
|
||||
|
||||
public Vector<int> GetImmediateFrameUnwindList(SourceMarkupLoader owner) => this.GetImmediateFrameUnwindList(owner, false);
|
||||
|
||||
public Vector<int> GetLoopUnwindList(SourceMarkupLoader owner) => this.GetImmediateFrameUnwindList(owner, true);
|
||||
|
||||
public ValidateStatementLoop EnclosingLoop => this._loopStatementStack.Count <= 0 ? (ValidateStatementLoop)null : this._loopStatementStack.Peek();
|
||||
public ValidateStatementLoop EnclosingLoop => this._loopStatementStack.Count <= 0 ? null : this._loopStatementStack.Peek();
|
||||
|
||||
public int TrackSymbolUsage(string symbol, SymbolOrigin origin)
|
||||
{
|
||||
@@ -553,7 +553,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
public Vector<ValidateExpression> StopDeclaredTriggerTracking()
|
||||
{
|
||||
Vector<ValidateExpression> triggerTrackingList = this._declaredTriggerTrackingList;
|
||||
this._declaredTriggerTrackingList = (Vector<ValidateExpression>)null;
|
||||
this._declaredTriggerTrackingList = null;
|
||||
return triggerTrackingList;
|
||||
}
|
||||
|
||||
@@ -573,7 +573,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
}
|
||||
else
|
||||
flag = false;
|
||||
this._notifierTrackingRoot = (ValidateExpression)null;
|
||||
this._notifierTrackingRoot = null;
|
||||
return flag;
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
|
||||
public Vector<TriggerRecord> TriggerList => this._triggerList;
|
||||
|
||||
public PropertySchema GetActivePropertyScope() => this._propertyScopeStack.Count == 0 ? (PropertySchema)null : this._propertyScopeStack.Peek().property;
|
||||
public PropertySchema GetActivePropertyScope() => this._propertyScopeStack.Count == 0 ? null : this._propertyScopeStack.Peek().property;
|
||||
|
||||
public NameUsage GetActiveNameUsage()
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
if (this._currentValidationPass >= currentPass)
|
||||
return;
|
||||
this._currentValidationPass = currentPass;
|
||||
ValidateContext context = new ValidateContext((ValidateClass)null, (MarkupTypeSchema)null, this._currentValidationPass);
|
||||
ValidateContext context = new ValidateContext(null, null, this._currentValidationPass);
|
||||
this.Validate(TypeRestriction.None, context);
|
||||
if (this._currentValidationPass != LoadPass.Full)
|
||||
return;
|
||||
@@ -43,7 +43,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
case MarkupDataTypeSchema _:
|
||||
markupDataTypeSchema = (MarkupDataTypeSchema)typeSchemaProperty;
|
||||
string stringProperty1 = this.ExtractStringProperty("Provider", true);
|
||||
MarkupDataMappingEntry[] mappingEntries = (MarkupDataMappingEntry[])null;
|
||||
MarkupDataMappingEntry[] mappingEntries = null;
|
||||
ValidateProperty property = this.FindProperty("Mappings");
|
||||
if (property != null && property.IsObjectTagValue)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
dataMappingEntry.Property = propertyDeep;
|
||||
dataMappingEntry.Source = stringProperty3;
|
||||
dataMappingEntry.Target = stringProperty4;
|
||||
dataMappingEntry.DefaultValue = ValidateDataMapping.ConvertDefaultValue((Microsoft.Iris.Markup.Validation.Validate)this, propertyDeep.PropertyType, stringProperty5);
|
||||
dataMappingEntry.DefaultValue = ValidateDataMapping.ConvertDefaultValue(this, propertyDeep.PropertyType, stringProperty5);
|
||||
if (!entries.ContainsKey(stringProperty2))
|
||||
entries[stringProperty2] = dataMappingEntry;
|
||||
else
|
||||
@@ -75,11 +75,11 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
}
|
||||
mappingEntries = MarkupDataProvider.FillInDefaultMappings(markupDataTypeSchema, entries);
|
||||
foreach (MarkupDataMappingEntry dataMappingEntry in mappingEntries)
|
||||
this.Owner.TrackImportedProperty((PropertySchema)dataMappingEntry.Property);
|
||||
this.Owner.TrackImportedProperty(dataMappingEntry.Property);
|
||||
}
|
||||
if (stringProperty1 == null || markupDataTypeSchema == null)
|
||||
break;
|
||||
ValidateDataMapping.AddDataMappingProviderList(ref this._foundDataMappingSet, (MarkupLoadResult)this.Owner.LoadResultTarget, this.Name, markupDataTypeSchema, stringProperty1, mappingEntries);
|
||||
ValidateDataMapping.AddDataMappingProviderList(ref this._foundDataMappingSet, Owner.LoadResultTarget, this.Name, markupDataTypeSchema, stringProperty1, mappingEntries);
|
||||
break;
|
||||
default:
|
||||
this.ReportError("TargetType for DataMapping must be a markup-defined DataType, {0} is not valid", typeSchemaProperty.Name);
|
||||
@@ -131,12 +131,12 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
TypeSchema type,
|
||||
string valueString)
|
||||
{
|
||||
object instance = (object)null;
|
||||
object instance = null;
|
||||
if (valueString != null)
|
||||
{
|
||||
if (type.SupportsTypeConversion((TypeSchema)StringSchema.Type))
|
||||
if (type.SupportsTypeConversion(StringSchema.Type))
|
||||
{
|
||||
Result result = type.TypeConverter((object)valueString, (TypeSchema)StringSchema.Type, out instance);
|
||||
Result result = type.TypeConverter(valueString, StringSchema.Type, out instance);
|
||||
if (result.Failed)
|
||||
validate.ReportError(result.Error);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
MarkupPropertySchema propertyExport)
|
||||
{
|
||||
string stringProperty = objectTag.ExtractStringProperty("DefaultValue", false);
|
||||
object obj = ValidateDataMapping.ConvertDefaultValue((Validate)this, propertyExport.PropertyType, stringProperty);
|
||||
object obj = ValidateDataMapping.ConvertDefaultValue(this, propertyExport.PropertyType, stringProperty);
|
||||
((MarkupDataQueryPropertySchema)propertyExport).DefaultValue = obj;
|
||||
bool flag;
|
||||
if (objectTag.ExtractBooleanProperty("InvalidatesQuery", context, false, out flag))
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
this._foundInlineMappings = new Map<string, MarkupDataMappingEntry>();
|
||||
this._foundInlineMappings[propertyExport.Name] = new MarkupDataMappingEntry()
|
||||
{
|
||||
DefaultValue = ValidateDataMapping.ConvertDefaultValue((Validate)this, propertyExport.PropertyType, stringProperty1),
|
||||
DefaultValue = ValidateDataMapping.ConvertDefaultValue(this, propertyExport.PropertyType, stringProperty1),
|
||||
Source = stringProperty2,
|
||||
Target = stringProperty3,
|
||||
Property = (MarkupDataTypePropertySchema)propertyExport
|
||||
@@ -71,9 +71,9 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
this._foundInlineMappings = new Map<string, MarkupDataMappingEntry>();
|
||||
MarkupDataTypeSchema typeExport = (MarkupDataTypeSchema)this.TypeExport;
|
||||
MarkupDataMappingEntry[] mappingEntries = MarkupDataProvider.FillInDefaultMappings(typeExport, this._foundInlineMappings);
|
||||
ValidateDataMapping.AddDataMappingProviderList(ref this._foundDataMappingSet, (MarkupLoadResult)this.Owner.LoadResultTarget, (string)null, typeExport, this._provider, mappingEntries);
|
||||
ValidateDataMapping.AddDataMappingProviderList(ref this._foundDataMappingSet, Owner.LoadResultTarget, null, typeExport, this._provider, mappingEntries);
|
||||
foreach (MarkupDataMappingEntry dataMappingEntry in mappingEntries)
|
||||
this.Owner.TrackImportedProperty((PropertySchema)dataMappingEntry.Property);
|
||||
this.Owner.TrackImportedProperty(dataMappingEntry.Property);
|
||||
}
|
||||
|
||||
public Vector<MarkupDataMapping> FoundDataMappingSet => this._foundDataMappingSet;
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
private string GetEffectElementName(ValidateExpressionCall call)
|
||||
{
|
||||
ValidateExpression target = call.Target;
|
||||
return EffectElementInstanceSchema.Type.IsAssignableFrom(target.ObjectType) && target.ExpressionType == ExpressionType.Symbol ? ((ValidateExpressionSymbol)target).Symbol : (string)null;
|
||||
return EffectElementInstanceSchema.Type.IsAssignableFrom(target.ObjectType) && target.ExpressionType == ExpressionType.Symbol ? ((ValidateExpressionSymbol)target).Symbol : null;
|
||||
}
|
||||
|
||||
private void TrackDynamicElementAssignment(string elementName, string propertyName) => this.TrackDynamicElementAssignment(EffectElementWrapper.MakeEffectPropertyName(elementName, propertyName));
|
||||
@@ -127,7 +127,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
{
|
||||
if (this._foundDynamicElementAssignments == null)
|
||||
this._foundDynamicElementAssignments = new Dictionary<string, object>();
|
||||
this._foundDynamicElementAssignments[dynamicPropertyName] = (object)null;
|
||||
this._foundDynamicElementAssignments[dynamicPropertyName] = null;
|
||||
}
|
||||
|
||||
public void TrackInstanceProperty(
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
|
||||
protected void DeclareEvaluationType(TypeSchema evaluationType, TypeRestriction typeRestriction)
|
||||
{
|
||||
if (!typeRestriction.Check((ValidateObject)this, evaluationType))
|
||||
if (!typeRestriction.Check(this, evaluationType))
|
||||
return;
|
||||
this._evaluationType = evaluationType;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "this");
|
||||
if (context.CurrentMethod == null || !context.CurrentMethod.HasOverrideKeyword)
|
||||
this.ReportError("'base' keyword can only be used in an override method");
|
||||
this.DeclareEvaluationType((TypeSchema)context.Owner.TypeExport, TypeRestriction.None);
|
||||
this.DeclareEvaluationType(context.Owner.TypeExport, TypeRestriction.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
this._parameterList = parameterList;
|
||||
}
|
||||
|
||||
public ValidateExpression Target => !this._foundTargetIsStatic ? this._target : (ValidateExpression)null;
|
||||
public ValidateExpression Target => !this._foundTargetIsStatic ? this._target : null;
|
||||
|
||||
public string MemberName => this._memberName;
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
this._foundMemberType = SchemaType.Event;
|
||||
this._foundMemberIndex = this.Owner.TrackImportedEvent(eventDeep);
|
||||
expressionRestriction = ExpressionRestriction.ReadOnly;
|
||||
this.DeclareEvaluationType((TypeSchema)VoidSchema.Type, typeRestriction);
|
||||
this.DeclareEvaluationType(VoidSchema.Type, typeRestriction);
|
||||
this.DeclareNotifies(context);
|
||||
}
|
||||
}
|
||||
@@ -212,15 +212,15 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
|
||||
private void ValidateBaseCall(TypeRestriction typeRestriction, ValidateContext context)
|
||||
{
|
||||
MarkupMethodSchema markupMethodSchema = context.CurrentMethod != null ? context.CurrentMethod.FoundBaseMethod : (MarkupMethodSchema)null;
|
||||
MarkupMethodSchema markupMethodSchema = context.CurrentMethod != null ? context.CurrentMethod.FoundBaseMethod : null;
|
||||
if (markupMethodSchema != null)
|
||||
{
|
||||
if (this._parameterList == null || this._memberName != markupMethodSchema.Name)
|
||||
this.ReportError("'base' keyword can only be used to call the base virtual method inside an override");
|
||||
else if (new MethodSignatureKey(markupMethodSchema.Name, markupMethodSchema.ParameterTypes).Equals((object)new MethodSignatureKey(this._memberName, this._foundParameterTypes)))
|
||||
else if (new MethodSignatureKey(markupMethodSchema.Name, markupMethodSchema.ParameterTypes).Equals(new MethodSignatureKey(this._memberName, this._foundParameterTypes)))
|
||||
{
|
||||
this._foundMemberType = SchemaType.Method;
|
||||
this._foundMemberIndex = this.Owner.TrackImportedMethod((MethodSchema)markupMethodSchema);
|
||||
this._foundMemberIndex = this.Owner.TrackImportedMethod(markupMethodSchema);
|
||||
this.DeclareEvaluationType(markupMethodSchema.ReturnType, typeRestriction);
|
||||
}
|
||||
else
|
||||
@@ -244,7 +244,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
++length;
|
||||
}
|
||||
if (this.HasErrors)
|
||||
return (TypeSchema[])null;
|
||||
return null;
|
||||
typeSchemaArray = new TypeSchema[length];
|
||||
int index = 0;
|
||||
for (ValidateParameter validateParameter = this._parameterList; validateParameter != null; validateParameter = validateParameter.Next)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
else
|
||||
{
|
||||
ValidateExpressionSymbol expressionSymbol = (ValidateExpressionSymbol)typeCastExpression;
|
||||
this._typeCast = new ValidateTypeIdentifier(owner, (string)null, expressionSymbol.Symbol, expressionSymbol.Line, expressionSymbol.Column);
|
||||
this._typeCast = new ValidateTypeIdentifier(owner, null, expressionSymbol.Symbol, expressionSymbol.Line, expressionSymbol.Column);
|
||||
}
|
||||
this._castee = castee;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
int column)
|
||||
: base(owner, line, column, ExpressionType.Constant)
|
||||
{
|
||||
this._constantInline = (string)null;
|
||||
this._constantInline = null;
|
||||
this._constantType = ConstantType.Boolean;
|
||||
this._foundConstant = BooleanBoxes.Box(constantValue);
|
||||
}
|
||||
@@ -53,43 +53,43 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
case ConstantType.String:
|
||||
int errorIndex;
|
||||
string invalidSequence;
|
||||
this._foundConstant = (object)StringUtility.Unescape(this._constantInline, out errorIndex, out invalidSequence);
|
||||
this._foundConstant = StringUtility.Unescape(this._constantInline, out errorIndex, out invalidSequence);
|
||||
if (this._foundConstant == null)
|
||||
this.ReportErrorWithAdjustedPosition(string.Format("Invalid escape sequence '{0}' in string literal", (object)invalidSequence), 0, errorIndex + 1);
|
||||
evaluationType = (TypeSchema)StringSchema.Type;
|
||||
this.ReportErrorWithAdjustedPosition(string.Format("Invalid escape sequence '{0}' in string literal", invalidSequence), 0, errorIndex + 1);
|
||||
evaluationType = StringSchema.Type;
|
||||
break;
|
||||
case ConstantType.StringLiteral:
|
||||
this._foundConstant = (object)this._constantInline;
|
||||
this._foundConstant = _constantInline;
|
||||
this._constantType = ConstantType.String;
|
||||
evaluationType = (TypeSchema)StringSchema.Type;
|
||||
evaluationType = StringSchema.Type;
|
||||
break;
|
||||
case ConstantType.Integer:
|
||||
Result result1 = Int32Schema.Type.TypeConverter((object)this._constantInline, (TypeSchema)StringSchema.Type, out this._foundConstant);
|
||||
Result result1 = Int32Schema.Type.TypeConverter(_constantInline, StringSchema.Type, out this._foundConstant);
|
||||
if (result1.Failed)
|
||||
this.ReportError(result1.Error);
|
||||
evaluationType = (TypeSchema)Int32Schema.Type;
|
||||
evaluationType = Int32Schema.Type;
|
||||
break;
|
||||
case ConstantType.LongInteger:
|
||||
Result result2 = Int64Schema.Type.TypeConverter((object)this._constantInline, (TypeSchema)StringSchema.Type, out this._foundConstant);
|
||||
Result result2 = Int64Schema.Type.TypeConverter(_constantInline, StringSchema.Type, out this._foundConstant);
|
||||
if (result2.Failed)
|
||||
this.ReportError(result2.Error);
|
||||
evaluationType = (TypeSchema)Int64Schema.Type;
|
||||
evaluationType = Int64Schema.Type;
|
||||
break;
|
||||
case ConstantType.Float:
|
||||
Result result3 = SingleSchema.Type.TypeConverter((object)this._constantInline, (TypeSchema)StringSchema.Type, out this._foundConstant);
|
||||
Result result3 = SingleSchema.Type.TypeConverter(_constantInline, StringSchema.Type, out this._foundConstant);
|
||||
if (result3.Failed)
|
||||
this.ReportError(result3.Error);
|
||||
evaluationType = (TypeSchema)SingleSchema.Type;
|
||||
evaluationType = SingleSchema.Type;
|
||||
break;
|
||||
case ConstantType.Boolean:
|
||||
evaluationType = (TypeSchema)BooleanSchema.Type;
|
||||
evaluationType = BooleanSchema.Type;
|
||||
break;
|
||||
case ConstantType.Null:
|
||||
this._foundConstant = (object)null;
|
||||
evaluationType = (TypeSchema)NullSchema.Type;
|
||||
this._foundConstant = null;
|
||||
evaluationType = NullSchema.Type;
|
||||
break;
|
||||
default:
|
||||
evaluationType = (TypeSchema)null;
|
||||
evaluationType = null;
|
||||
break;
|
||||
}
|
||||
this.DeclareEvaluationType(evaluationType, typeRestriction);
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
}
|
||||
finally
|
||||
{
|
||||
ValidateExpressionDeclareTrigger.StopNotifierTracking((Microsoft.Iris.Markup.Validation.Validate)this, context, this._expression);
|
||||
ValidateExpressionDeclareTrigger.StopNotifierTracking(this, context, this._expression);
|
||||
}
|
||||
if (this._expression.HasErrors)
|
||||
this.MarkHasErrors();
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
this._index = index;
|
||||
}
|
||||
|
||||
public ValidateExpression CallExpression => (ValidateExpression)this._call;
|
||||
public ValidateExpression CallExpression => _call;
|
||||
|
||||
public override void Validate(TypeRestriction typeRestriction, ValidateContext context)
|
||||
{
|
||||
@@ -45,7 +45,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
this._index.AppendToEnd(new ValidateParameter(this.Owner, this._assignmentValue, this._assignmentValue.Line, this._assignmentValue.Column));
|
||||
this._call = new ValidateExpressionCall(this.Owner, this._indexee, "set_Item", this._index, this.Line, this.Column);
|
||||
this._call.SetAsIndexAssignment();
|
||||
this._call.Validate(new TypeRestriction((TypeSchema)VoidSchema.Type), context);
|
||||
this._call.Validate(new TypeRestriction(VoidSchema.Type), context);
|
||||
if (this._call.HasErrors)
|
||||
this.MarkHasErrors();
|
||||
else
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
this._typeIdentifier.Validate();
|
||||
if (this._typeIdentifier.HasErrors)
|
||||
this.MarkHasErrors();
|
||||
this.DeclareEvaluationType((TypeSchema)BooleanSchema.Type, typeRestriction);
|
||||
this.DeclareEvaluationType(BooleanSchema.Type, typeRestriction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
: base(owner, line, column, ExpressionType.List)
|
||||
=> this._expressionList = new ArrayList();
|
||||
|
||||
public void AppendToEnd(ValidateExpression expression) => this._expressionList.Add((object)expression);
|
||||
public void AppendToEnd(ValidateExpression expression) => this._expressionList.Add(expression);
|
||||
|
||||
public ArrayList Expressions => this._expressionList;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
}
|
||||
}
|
||||
else
|
||||
this.DeclareEvaluationType((TypeSchema)VoidSchema.Type, typeRestriction);
|
||||
this.DeclareEvaluationType(VoidSchema.Type, typeRestriction);
|
||||
if (this.ObjectType == null)
|
||||
this.MarkHasErrors();
|
||||
else
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Microsoft.Iris.Markup.Validation
|
||||
: base(owner, line, column, ExpressionType.New)
|
||||
{
|
||||
if (parameterList == ValidateParameter.EmptyList)
|
||||
parameterList = (ValidateParameter)null;
|
||||
parameterList = null;
|
||||
this._constructType = constructType;
|
||||
this._parameterList = parameterList;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user