Exemplo n.º 1
0
 public override void HandleError(Node offendingNode, SysError error, params string[] messageParameters){
   Error e = ErrorHandler.MapError(error);
   if (e == Error.None) return;
   if (e == Error.UnexpectedToken){
     base.HandleError(offendingNode, error, messageParameters);
     return;
   }
   if (e == Error.NameNotInContext){
     if (messageParameters != null && messageParameters.Length == 1){
       string[] mpars = new string[2];
       mpars[0] = messageParameters[0];
       if (this.currentType != null)
         mpars[1] = this.GetTypeName(this.currentType);
       else
         mpars[1] = "";
       messageParameters = mpars;
     }
   }
   if (e == Error.AssgReadonlyLocalCause){
     string[] mpars = new string[2];
     mpars[0] = messageParameters[0];
     if (error == SysError.AssignmentToFixedVariable)
       mpars[1] = "fixed variable"; //TODO: this string should be localized
     else
       mpars[1] = "";
     messageParameters = mpars;
   }
   if (this.refOrOutAddress){
     switch (e){
       case Error.AssgLvalueExpected: e = Error.RefLvalueExpected; break;
       case Error.AssgReadonly: e = Error.RefReadonly; break;
       case Error.AssgReadonlyLocal: e = Error.RefReadonlyLocal; break;
       case Error.AssgReadonlyLocalCause: e = Error.RefReadonlyLocalCause; break;
       case Error.AssgReadonlyProp: e = Error.RefReadonlyProperty; break;
       case Error.AssgReadonlyStatic: e = Error.RefReadonlyStatic; break;
     }
   }
   this.HandleError(offendingNode, e, messageParameters);
 }
Exemplo n.º 2
0
    internal static Error MapError(SysError error){
      switch(error){
        case SysError.AbstractAndExtern: return Error.AbstractAndExtern;
        case SysError.AbstractAttributeClass: return Error.AbstractAttributeClass;
        case SysError.AbstractBaseCall: return Error.AbstractBaseCall;
        case SysError.AbstractEventInitializer: return Error.AbstractEventInitializer;
        case SysError.AbstractHasBody: return Error.AbstractHasBody;
        case SysError.AbstractInterfaceMethod: return Error.AbstractInterfaceMethod;
        case SysError.AbstractMethodInConcreteType: return Error.AbstractInConcreteClass;
        case SysError.AbstractMethodTemplate: return Error.AbstractMethodTemplate;
        case SysError.AbstractSealedArrayElementType: return Error.ArrayOfStaticClass;
        case SysError.AbstractSealedBaseClass: return Error.StaticBaseClass;
        case SysError.AbstractSealedClassInterfaceImpl: return Error.StaticClassInterfaceImpl;
        case SysError.AbstractSealedDerivedFromNonObject: return Error.StaticDerivedFromNonObject;
        case SysError.AbstractSealedFieldType: return Error.VarDeclIsStaticClass;
        case SysError.AbstractSealedLocalType: return Error.VarDeclIsStaticClass;
        case SysError.AbstractSealedParameterType: return Error.ParameterIsStaticClass;
        case SysError.AbstractSealedReturnType: return Error.ReturnTypeIsStaticClass;
        case SysError.AccessThroughDelayedReference: return Error.AccessThroughDelayedReference;
        case SysError.AccessThroughDelayedThisInConstructor: return Error.AccessThroughDelayedThisInConstructor;
        case SysError.AccessToNonStaticOuterMember: return Error.WrongNestedThis;
        case SysError.ActualCannotBeDelayed: return Error.ActualCannotBeDelayed;
        case SysError.ActualMustBeDelayed: return Error.ActualMustBeDelayed;
        case SysError.AliasNotFound: return Error.AliasNotFound;
        case SysError.AlwaysNull: return Error.AlwaysNull;
        case SysError.AmbiguousBinaryOperation: return Error.AmbigBinaryOps;
        case SysError.AmbiguousCall: return Error.AmbigCall;
        case SysError.AmbiguousConditional: return Error.AmbigQM;
        case SysError.AmbiguousTypeReference: return Error.AmbigContext;
        case SysError.AnonymousNestedFunctionNotAllowed: return Error.AnonMethNotAllowed;
        case SysError.ArrayElementCannotBeTypedReference: return Error.ArrayElementCantBeRefAny;
        case SysError.ArrayInitializerLengthMismatch: return Error.InvalidArray;
        case SysError.AsMustHaveReferenceType: return Error.AsMustHaveReferenceType;
        case SysError.AssemblyCouldNotBeSigned: return Error.CryptoFailed;
        case SysError.AssemblyKeyFileMissing: return Error.AssemblyKeyFileMissing;
        case SysError.AssignmentHasNoEffect: return Error.AssgLvalueExpected;
        case SysError.AssignmentToBase: return Error.BaseIllegal;
        case SysError.AssignmentToEvent: return Error.BadEventUsageNoField;
        case SysError.AssignmentToFixedVariable: return Error.AssgReadonlyLocalCause;
        case SysError.AssignmentToLiteral: return Error.AssgLvalueExpected;
        case SysError.AssignmentToReadOnlyInstanceField: return Error.AssgReadonly;
        case SysError.AssignmentToReadOnlyLocal: return Error.AssgReadonlyLocal;
        case SysError.AssignmentToReadOnlyStaticField: return Error.AssgReadonlyStatic;
        case SysError.AssignmentToType: return Error.BadSKknown;
        case SysError.AsWithTypeVar: return Error.AsWithTypeVar;
        case SysError.AttributeOnBadTarget: return Error.AttributeOnBadSymbolType;
        case SysError.AttributeHasBadTarget: return Error.AttributeLocationOnBadDeclaration;
        case SysError.AttributeUsageOnNonAttributeClass: return Error.AttributeUsageOnNonAttributeClass;
        case SysError.AutoWin32ResGenFailed: return Error.AutoResGen;
        case SysError.BadAttributeParam: return Error.BadAttributeParam;
        case SysError.BadBinaryOperatorSignature: return Error.BadBinaryOperatorSignature;
        case SysError.BadBinaryOps: return Error.BadBinaryOps;
        case SysError.BadBox: return Error.BadBox;
        case SysError.BadBoolOp: return Error.BadBoolOp;
        case SysError.BadCallToEventHandler: return Error.BadEventUsageNoField;
        case SysError.BadExplicitCoercionInFixed: return Error.BadCastInFixed;
        case SysError.BadEmptyThrow: return Error.BadEmptyThrow;
        case SysError.BadExceptionType: return Error.BadExceptionType;
        case SysError.BadExitOrContinue: return Error.NoBreakOrCont;
        case SysError.BadFinallyLeave: return Error.BadFinallyLeave;
        case SysError.BadFixedVariableType: return Error.BadFixedInitType;
        case SysError.BadForeachCollection: return Error.ForEachMissingMember;
        case SysError.BadGetEnumerator: return Error.BadGetEnumerator;
        case SysError.BadIncDecSignature: return Error.BadIncDecSignature;
        case SysError.BadNamedAttributeArgument: return Error.BadNamedAttributeArgument;
        case SysError.BadNamedAttributeArgumentType: return Error.BadNamedAttributeArgumentType;
        case SysError.BadNestedTypeReference: return Error.BadTypeReference;
        case SysError.BadNonEmptyStream: return Error.BadNonEmptyStream;
        case SysError.BadNonNull: return Error.BadNonNull;
        case SysError.BadNonNullOnStream: return Error.BadNonNullOnStream;
        case SysError.BadRefCompareLeft: return Error.BadRefCompareLeft;
        case SysError.BadRefCompareRight: return Error.BadRefCompareRight;
        case SysError.BadStream: return Error.BadStream;
        case SysError.BadStreamOnNonNullStream: return Error.BadStreamOnNonNullStream;
        case SysError.BadTupleIndex : return Error.BadTupleIndex;
        case SysError.BadUnaryOp: return Error.BadUnaryOp;
        case SysError.BadUnaryOperatorSignature: return Error.BadUnaryOperatorSignature;
        case SysError.BadUseOfEvent: return Error.BadEventUsageNoField;
        case SysError.BadUseOfMethod: return Error.BadUseOfMethod;
        case SysError.BaseClassLessAccessible: return Error.BadVisBaseClass;
        case SysError.BaseInBadContext: return Error.BaseInBadContext;
        case SysError.BaseInStaticCode: return Error.BaseInStaticMeth;
        case SysError.BaseInterfaceLessAccessible: return Error.BadVisBaseInterface;
        case SysError.BaseMultipleInitialization: return Error.BaseMultipleInitialization;
        case SysError.BaseNotInitialized: return Error.BaseNotInitialized;
        case SysError.BatchFileNotRead: return Error.BatchFileNotRead;
        case SysError.BitwiseOrSignExtend: return Error.BitwiseOrSignExtend;
        case SysError.CannotCallSpecialMethod: return Error.CantCallSpecialMethod;
        case SysError.CannotCoerceNullToValueType: return Error.ValueCantBeNull;
        case SysError.CannotDeferenceNonPointerType: return Error.PtrExpected;
        case SysError.CannotDeriveFromSealedType: return Error.CantDeriveFromSealedClass;
        case SysError.CannotDeriveFromSpecialType: return Error.DeriveFromEnumOrValueType;
        case SysError.CannotExplicitlyImplementAccessor: return Error.ExplicitMethodImplAccessor;
        case SysError.CannotInferMethTypeArgs: return Error.CantInferMethTypeArgs;
        case SysError.CannotMatchArglist: return Error.CannotMatchArglist;
        case SysError.CannotOverrideAccessor: return Error.CantOverrideAccessor;
        case SysError.CannotOverrideFinal: return Error.CantOverrideSealed;
        case SysError.CannotOverrideNonEvent: return Error.CantOverrideNonEvent;
        case SysError.CannotOverrideNonVirtual: return Error.CantOverrideNonVirtual;
        case SysError.CannotOverrideSpecialMethod: return Error.CantOverrideSpecialMethod;
        case SysError.CannotReturnTypedReference: return Error.MethodReturnCantBeRefAny;
        case SysError.CannotReturnValue: return Error.RetNoObjectRequired;
        case SysError.CannotYieldFromCatchClause: return Error.CannotYieldFromCatchClause;
        case SysError.CannotYieldFromTryBlock: return Error.CannotYieldFromTryBlock;
        case SysError.CaseFallThrough: return Error.CaseFallThrough;
        case SysError.CheckedExceptionNotInThrowsClause: return Error.CheckedExceptionNotInThrowsClause;
        case SysError.CircularBase: return Error.CircularBase;
        case SysError.CircularConstantDefinition: return Error.CircConstValue;
        case SysError.ClashWithLocalConstant: return Error.LocalConstDuplicate;
        case SysError.ClashWithLocalVariable: return Error.LocalDuplicate;
        case SysError.CloseUnimplementedInterfaceMember: return Error.CloseUnimplementedInterfaceMember;
        case SysError.CLSNotOnModules: return Error.CLSNotOnModules;
        case SysError.ComImportWithoutGuidAttribute: return Error.ComImportWithoutUuidAttribute;
        case SysError.ConcreteMissingBody: return Error.ConcreteMissingBody;
        case SysError.ConditionalMustReturnVoid: return Error.ConditionalMustReturnVoid;
        case SysError.ConditionalOnInterfaceMethod: return Error.ConditionalOnInterfaceMethod;
        case SysError.ConditionalOnOverride: return Error.ConditionalOnOverride;
        case SysError.ConditionalOnSpecialMethod: return Error.ConditionalOnSpecialMethod;
        case SysError.ConflictBetweenAliasAndType: return Error.ConflictAliasAndMember;
        case SysError.ConstantExpected: return Error.ConstantExpected;
        case SysError.ConstraintIsAbstractSealedClass: return Error.ConstraintIsStaticClass;
        case SysError.ConstructsAbstractClass: return Error.NoNewAbstract;
        case SysError.ConstructsAbstractSealedClass: return Error.InstantiatingStaticClass;
        case SysError.ConstructorInAbstractSealedClass: return Error.ConstructorInStaticClass;
        case SysError.ContainingTypeDoesNotImplement: return Error.ClassDoesntImplementInterface;
        case SysError.ConversionNotInvolvingContainedType: return Error.ConversionNotInvolvingContainedType;
        case SysError.ConversionWithBase: return Error.ConversionWithBase;
        case SysError.ConversionWithDerived: return Error.ConversionWithDerived;
        case SysError.ConversionWithInterface: return Error.ConversionWithInterface;
        case SysError.CTOverflow: return Error.CheckedOverflow;
        case SysError.CustomAttributeError: return Error.CustomAttributeError;
        case SysError.CycleInInterfaceInheritance: return Error.CycleInInterfaceInheritance;
        case SysError.DestructorInAbstractSealedClass: return Error.DestructorInStaticClass;
        case SysError.DefaultContructorConstraintNotSatisfied: return Error.NewConstraintNotSatisfied;
        case SysError.DelayedReferenceByReference: return Error.DelayedReferenceByReference;
        case SysError.DelayedRefParameter: return Error.DelayedRefParameter;
        case SysError.DelayedStructConstructor: return Error.DelayedStructConstructor;
        case SysError.DllImportOnInvalidMethod: return Error.DllImportOnInvalidMethod;
        case SysError.DuplicateAliasDefinition: return Error.DuplicateAlias;
        case SysError.DuplicateAssemblyReference: return Error.None;
        case SysError.DuplicateAttribute: return Error.DuplicateAttribute;
        case SysError.DuplicateCaseLabel: return Error.DuplicateCaseLabel;
        case SysError.DuplicateConversion: return Error.DuplicateConversionInClass;
        case SysError.DuplicateIndexer: return Error.MemberAlreadyExists;
        case SysError.DuplicateInterfaceInBaseList: return Error.DuplicateInterfaceInBaseList;
        case SysError.DuplicateMethod: return Error.MemberAlreadyExists;
        case SysError.DuplicateModuleReference: return Error.None;
        case SysError.DuplicateNamedAttributeArgument: return Error.DuplicateNamedAttributeArgument;
        case SysError.DuplicateParameterName: return Error.DuplicateParamName;
        case SysError.DuplicateResponseFile: return Error.DuplicateResponseFile;
        case SysError.DuplicateType: return Error.DuplicateNameInNS;
        case SysError.DuplicateTypeMember: return Error.DuplicateNameInClass;
        case SysError.DuplicateUsedNamespace: return Error.DuplicateUsing;
        case SysError.EnumerationValueOutOfRange: return Error.EnumeratorOverflow;
        case SysError.EventNotDelegate: return Error.EventNotDelegate;
        case SysError.EqualityOpWithoutEquals: return Error.EqualityOpWithoutEquals;
        case SysError.EqualityOpWithoutGetHashCode: return Error.EqualityOpWithoutGetHashCode;
        case SysError.Error: return Error.Error;
        case SysError.ExplicitDefaultConstructorForValueType: return Error.StructsCantContainDefaultContructor;
        case SysError.ExplicitlyImplementedTypeNotInterface: return Error.ExplicitInterfaceImplementationNotInterface;
        case SysError.ExplicitPropertyAddingAccessor: return Error.ExplicitPropertyAddingAccessor;
        case SysError.ExplicitPropertyMissingAccessor: return Error.ExplicitPropertyMissingAccessor;
        case SysError.ExpressionIsAlreadyOfThisType: return Error.ExpressionIsAlreadyOfThisType;
        case SysError.FamilyInSealed: return Error.ProtectedInSealed;
        case SysError.FamilyInStruct: return Error.ProtectedInStruct;
        case SysError.FatalError: return Error.FatalError;
        case SysError.FieldOffsetNotAllowed: return Error.StructOffsetOnBadStruct;
        case SysError.FieldOffsetNotAllowedOnStaticField: return Error.StructOffsetOnBadField;
        case SysError.FieldTypeLessAccessibleThanField: return Error.BadVisFieldType;
        case SysError.FixedMustInit: return Error.FixedMustInit;
        case SysError.FixedNeeded: return Error.FixedNeeded;
        case SysError.FixedNotNeeded: return Error.FixedNotNeeded;
        case SysError.GeneralComprehensionsNotAllowedInMethodContracts: return Error.GeneralComprehensionsNotAllowedInMethodContracts;
        case SysError.GenericWarning: return Error.GenericWarning;        
        case SysError.GlobalSingleTypeNameNotFound: return Error.GlobalSingleTypeNameNotFound;
        case SysError.GotoLeavesNestedMethod: return Error.BadDelegateLeave;
        case SysError.HidesAbstractMethod: return Error.HidingAbstractMethod;
        case SysError.IntegerDivisionByConstantZero: return Error.IntDivByZero;
        case SysError.IdentifierNotFound: return Error.NameNotInContext;
        case SysError.IdentityConversion: return Error.IdentityConversion;
        case SysError.IllegalPointerType: return Error.IllegalPointerType;
        case SysError.ImpossibleCast: return Error.NoExplicitBuiltinConv;
        case SysError.InaccessibleEventBackingField: return Error.BadEventUsage;
        case SysError.InconsistantIndexerNames: return Error.InconsistantIndexerNames;
        case SysError.IndexerInAbstractSealedClass: return Error.IndexerInStaticClass;
        case SysError.IndexerNameAttributeOnOverride: return Error.NameAttributeOnOverride;
        case SysError.IndexerNameNotIdentifier: return Error.BadArgumentToNameAttribute;
        case SysError.InstanceFieldInitializerInStruct: return Error.FieldInitializerInStruct;
        case SysError.InstanceMemberInAbstractSealedClass: return Error.InstanceMemberInStaticClass;
        case SysError.IntegralTypeValueExpected: return Error.IntegralTypeValueExpected;
        case SysError.InterfaceHasConstructor: return Error.InterfacesCannotContainConstructors;
        case SysError.InterfaceHasField: return Error.InterfacesCannotContainFields;
        case SysError.InterfaceImplementedByConditional: return Error.InterfaceImplementedByConditional;
        case SysError.InterfaceMemberHasBody: return Error.InterfaceMemberHasBody;
        case SysError.InterfaceMemberNotFound: return Error.InterfaceMemberNotFound;
        case SysError.InternalCompilerError: return Error.InternalCompilerError;
        case SysError.InvalidAddressOf: return Error.InvalidAddrOp;
        case SysError.InvalidAttributeArgument: return Error.InvalidAttributeArgument;
        case SysError.InvalidCodePage: return Error.BadCodePage;
        case SysError.InvalidCompilerOption: return Error.UnknownOption;
        case SysError.InvalidCompilerOptionArgument: return Error.InvalidCompilerOptionArgument;
        case SysError.InvalidConditional: return Error.InvalidQM;
        case SysError.InvalidData: return Error.InvalidData;
        case SysError.InvalidDebugInformationFile: return Error.DebugInitFile;
        case SysError.InvalidGotoCase: return Error.InvalidGotoCase;
        case SysError.InvalidMainMethodSignature: return Error.InvalidMainSig;
        case SysError.InvalidOutputFile: return Error.OutputWriteFailed;
        case SysError.InvalidWin32ResourceFileContent: return Error.BadWin32Res;
        case SysError.IsAlwaysOfType: return Error.IsAlwaysTrue;
        case SysError.IsBinaryFile: return Error.IsBinaryFile;
        case SysError.IsNeverOfType: return Error.IsAlwaysFalse;
        case SysError.LabelIdentiferAlreadyInUse: return Error.DuplicateLabel;
        case SysError.LabelNotFound: return Error.LabelNotFound;
        case SysError.LockNeedsReference: return Error.LockNeedsReference;
        case SysError.MainCantBeGeneric: return Error.MainCantBeGeneric;
        case SysError.ManagedAddr: return Error.ManagedAddr;
        case SysError.MemberDoesNotHideBaseClassMember: return Error.NewNotRequired;
        case SysError.MemberHidesBaseClassMember: return Error.NewRequired;
        case SysError.MemberHidesBaseClassOverridableMember: return Error.NewOrOverrideExpected;
        case SysError.MemberNotVisible: return Error.BadAccess;
        case SysError.MethodNameExpected: return Error.MethodNameExpected;
        case SysError.MissingStructOffset: return Error.MissingStructOffset;
        case SysError.MultipleMainMethods: return Error.MultipleEntryPoints;
        case SysError.MultipleTypeImport: return Error.MultipleTypeDefs;
        case SysError.MustHaveOpTF: return Error.MustHaveOpTF;
        case SysError.NegativeArraySize: return Error.NegativeArraySize;
        case SysError.NegativeStackAllocSize: return Error.NegativeStackAllocSize;
        case SysError.NestedFunctionDelegateParameterMismatch: return Error.CantConvAnonMethParams;
        case SysError.NestedFunctionDelegateParameterMismatchBecauseOfOutParameter: return Error.CantConvAnonMethNoParams;
        case SysError.NestedFunctionDelegateReturnTypeMismatch: return Error.CantConvAnonMethReturns;
        case SysError.NoExplicitCoercion: return Error.NoExplicitConversion;
        case SysError.NoImplicitCoercion: return Error.NoImplicitConversion;
        case SysError.NoImplicitCoercionFromConstant: return Error.ConstOutOfRange;
        case SysError.NoGetter: return Error.PropertyLacksGet;
        case SysError.NoGetterToOverride: return Error.NoGetToOverride;
        case SysError.NoMainMethod: return Error.NoEntryPoint;
        case SysError.NoMethodMatchesDelegate: return Error.InvalidCall;
        case SysError.NoMethodToOverride: return Error.CantOverrideNonFunction;
        case SysError.NonNullFieldNotInitializedBeforeConstructorCall: return Error.NonNullFieldNotInitializedBeforeConstructorCall;
        case SysError.NonNullFieldNotInitializedAtEndOfDelayedConstructor: return Error.NonNullFieldNotInitializedAtEndOfDelayedConstructor;
        case SysError.NonNullFieldNotInitializedByDefaultConstructor: return Error.NonNullFieldNotInitializedByDefaultConstructor;
        case SysError.NoOverloadWithMatchingArgumentCount: return Error.BadArgCount;
        case SysError.NoPropertyToOverride: return Error.CantOverrideNonProperty;
        case SysError.NoSetter: return Error.AssgReadonlyProp;
        case SysError.NoSetterToOverride: return Error.NoSetToOverride;
        case SysError.NoSourceFiles: return Error.NoSources;
        case SysError.NoSuchConstructor: return Error.NoConstructors;
        case SysError.NoSuchFile: return Error.NoSuchFile;
        case SysError.NoSuchLabel: return Error.LabelNotFound;
        case SysError.NoSuchMember: return Error.NoSuchMember;
        case SysError.NoSuchMethod: return Error.NoSuchMethod;
        case SysError.NoSuchNestedType: return Error.DottedTypeNameNotFoundInAgg;
        case SysError.NoSuchOperator: return Error.NoSuchOperator;
        case SysError.NoSuchQualifiedType: return Error.TypeNameNotFound;
        case SysError.NoSuchType: return Error.SingleTypeNameNotFound;
        case SysError.NonObsoleteOverridingObsolete: return Error.NonObsoleteOverridingObsolete;
        case SysError.NotAnAssembly: return Error.ImportNonAssembly;
        case SysError.NotAnAttribute: return Error.NotAnAttributeClass;
        case SysError.NotAnInterface: return Error.NonInterfaceInInterfaceList;
        case SysError.NotAModule: return Error.AddModuleAssembly;
        case SysError.NotAssignable: return Error.AssgLvalueExpected;
        case SysError.NotATemplateType : return Error.HasNoTypeVars;
        case SysError.NotAType: return Error.NotAType;
        case SysError.NotConstantExpression: return Error.NotConstantExpression;
        case SysError.NotIndexable: return Error.BadIndexLHS;
        case SysError.NotVisibleViaBaseType: return Error.BadProtectedAccess;
        case SysError.NotYetImplemented: return Error.FeatureNYI2;
        case SysError.NullNotAllowed: return Error.NullNotValid;
        case SysError.ObjectRequired: return Error.ObjectRequired;
        case SysError.ObsoleteError: return Error.DeprecatedSymbolError;
        case SysError.ObsoleteErrorWithMessage: return Error.DeprecatedSymbolStrError;
        case SysError.ObsoleteWarning: return Error.DeprecatedSymbol;
        case SysError.ObsoleteWarningWithMessage: return Error.DeprecatedSymbolStr;
        case SysError.OperatorInAbstractSealedClass: return Error.OperatorInStaticClass;
        case SysError.OperatorNeedsMatch: return Error.OperatorNeedsMatch;
        case SysError.OpTrueFalseMustResultInBool: return Error.OpTFRetType;
        case SysError.OverloadRefOut: return Error.OverloadRefOut;
        case SysError.OverrideChangesAccess: return Error.CantChangeAccessOnOverride;
        case SysError.OverrideChangesReturnType: return Error.CantChangeReturnTypeOnOverride;
        case SysError.OverrideNotExpected: return Error.OverrideNotExpected;
        case SysError.ParamArrayMustBeLast: return Error.ParamsOrVarargsMustBeLast;
        case SysError.ParamArrayParameterMustBeArrayType: return Error.ParamsMustBeArray;
        case SysError.ParameterLessAccessibleThanDelegate: return Error.BadVisDelegateParam;
        case SysError.ParameterLessAccessibleThanIndexedProperty: return Error.BadVisIndexerParam;
        case SysError.ParameterLessAccessibleThanMethod: return Error.BadVisParamType;
        case SysError.ParameterLessAccessibleThanOperator: return Error.BadVisOpParam;
        case SysError.ParameterTypeCannotBeTypedReference: return Error.MethodArgCantBeRefAny;
        case SysError.PartialClassesSpecifyMultipleBases: return Error.PartialMultipleBases;
        case SysError.PInvokeHasBody: return Error.ExternHasBody;
        case SysError.PInvokeWithoutModuleOrImportName: return Error.ExternMethodNoImplementation;
        case SysError.PointerInAsOrIs: return Error.PointerInAsOrIs;
        case SysError.PointerMustHaveSingleIndex: return Error.PtrIndexSingle;
        case SysError.PossibleBadNegCast: return Error.PossibleBadNegCast;
        case SysError.PropertyCantHaveVoidType: return Error.PropertyCantHaveVoidType;        
        case SysError.PropertyTypeLessAccessibleThanIndexedProperty: return Error.BadVisIndexerReturn;
        case SysError.PropertyTypeLessAccessibleThanProperty: return Error.BadVisPropertyType;
        case SysError.PropertyWithNoAccessors: return Error.PropertyWithNoAccessors;
        case SysError.QueryNotSupported: return Error.QueryNotSupported;
        case SysError.QueryNoMatch: return Error.QueryNoMatch;
        case SysError.QueryAmbiguousContextName: return Error.QueryAmbiguousContextName;
        case SysError.QueryBadAggregate: return Error.QueryBadAggregate;
        case SysError.QueryBadAggregateForm: return Error.QueryBadAggregateForm;
        case SysError.QueryBadGroupByList: return Error.QueryBadGroupByList;
        case SysError.QueryBadOrderList: return Error.QueryBadOrderList;
        case SysError.QueryBadProjectionList: return Error.QueryBadProjectionList;
        case SysError.QueryBadQuantifier: return Error.QueryBadQuantifier;
        case SysError.QueryBadQuantifiedExpression: return Error.QueryBadQuantifiedExpression;
        case SysError.QueryBadDifferenceTypes: return Error.QueryBadDifferenceTypes;
        case SysError.QueryBadInsertList: return Error.QueryBadInsertList;
        case SysError.QueryBadIntersectionTypes: return Error.QueryBadIntersectionTypes;
        case SysError.QueryBadLimit: return Error.QueryBadLimit;
        case SysError.QueryBadLimitNotLiteral: return Error.QueryBadLimitNotLiteral;
        case SysError.QueryBadLimitForNotPercent: return Error.QueryBadLimitForNotPercent;
        case SysError.QueryBadOrderItem: return Error.QueryBadOrderItem;
        case SysError.QueryBadUnionTypes: return Error.QueryBadUnionTypes;
        case SysError.QueryBadUpdateList: return Error.QueryBadUpdateList;
        case SysError.QueryBadTypeFilter: return Error.QueryBadTypeFilter;
        case SysError.QueryMissingDefaultConstructor: return Error.QueryMissingDefaultConstructor;
        case SysError.QueryNoContext: return Error.QueryNoContext;
        case SysError.QueryNotAddStream: return Error.QueryNotAddStream;
        case SysError.QueryNotDeleteStream: return Error.QueryNotDeleteStream;
        case SysError.QueryNotInsertStream: return Error.QueryNotInsertStream;
        case SysError.QueryNotScalar: return Error.QueryNotScalar;
        case SysError.QueryNotStream: return Error.QueryNotStream;
        case SysError.QueryNotTransactable: return Error.QueryNotTransactable;
        case SysError.QueryNotTransacted: return Error.QueryNotTransacted;
        case SysError.QueryNoNestedTransaction: return Error.QueryNoNestedTransaction;
        case SysError.QueryNotUpdateStream: return Error.QueryNotUpdateStream;
        case SysError.QueryProjectThroughTypeUnion: return Error.QueryProjectThroughTypeUnion;
        case SysError.QueryIsCyclic: return Error.QueryIsCyclic;
        case SysError.ReceiverCannotBeDelayed: return Error.ReceiverCannotBeDelayed;
        case SysError.ReceiverMustBeDelayed: return Error.ReceiverMustBeDelayed;
        case SysError.RecursiveConstructorCall: return Error.RecursiveConstructorCall;
        case SysError.RefConstraintNotSatisfied: return Error.RefConstraintNotSatisfied;
        case SysError.RedundantBox: return Error.RedundantBox;
        case SysError.RedundantNonNull: return Error.RedundantNonNull;
        case SysError.RedundantStream: return Error.RedundantStream;
        case SysError.RelatedErrorLocation: return Error.RelatedErrorLocation;
        case SysError.RelatedErrorModule: return Error.RelatedErrorModule;
        case SysError.RelatedWarningLocation: return Error.RelatedWarningLocation;
        case SysError.RelatedWarningModule: return Error.RelatedWarningModule;
        case SysError.ResultIsNotReference: return Error.ReturnNotLValue;
        case SysError.ReturnTypeLessAccessibleThanDelegate: return Error.BadVisDelegateReturn;
        case SysError.ReturnOfDelayedValue: return Error.ReturnOfDelayedValue;
        case SysError.ReturnTypeLessAccessibleThanMethod: return Error.BadVisReturnType;
        case SysError.ReturnTypeLessAccessibleThanOperator: return Error.BadVisOpReturn;
        case SysError.ReturnValueRequired: return Error.RetObjectRequired;
        case SysError.SealedTypeIsAlreadyInvariant: return Error.SealedTypeIsAlreadyInvariant;
        case SysError.SourceFileNotRead: return Error.SourceFileNotRead;
        case SysError.SizeofUnsafe: return Error.SizeofUnsafe;
        case SysError.StackallocInCatchFinally: return Error.StackallocInCatchFinally;
        case SysError.StaticNotVirtual: return Error.StaticNotVirtual;
        case SysError.TemplateTypeRequiresArgs: return Error.BadArity2;
        case SysError.ThisInBadContext: return Error.ThisInBadContext;
        case SysError.ThisInStaticCode: return Error.ThisInStaticMeth;
        case SysError.ThisReferenceFromFieldInitializer: return Error.FieldInitRefNonstatic;
        case SysError.ThrowsEnsuresOnConstructor: return Error.ThrowsEnsuresOnConstructor;
        case SysError.TooManyArgumentsToAttribute: return Error.TooManyArgumentsToAttribute;
        case SysError.TypeAliasUsedAsNamespacePrefix: return Error.ColColWithTypeAlias;
        case SysError.TypeArgsNotAllowed: return Error.TypeArgsNotAllowed;
        case SysError.TypeInBadContext: return Error.BadSKunknown;
        case SysError.TypeInVariableContext: return Error.BadSKknown;
        case SysError.TypeMissingInShadowedAssembly: return Error.TypeMissingInShadowedAssembly;
        case SysError.MethodMissingInShadowedAssembly: return Error.MethodMissingInShadowedAssembly;
        case SysError.TypeNameRequired: return Error.ObjectProhibited;
        case SysError.TypeNotAccessible: return Error.BadAccess;
        case SysError.TypeParameterNotCompatibleWithConstraint: return Error.GenericConstraintNotSatisfied;
        case SysError.TypeVarCantBeNull: return Error.TypeVarCantBeNull;
        case SysError.UnassignedThis: return Error.UnassignedThis;
        case SysError.UnimplementedAbstractMethod: return Error.UnimplementedAbstractMethod;
        case SysError.UnimplementedInterfaceMember: return Error.UnimplementedInterfaceMember;
        case SysError.UnreachableCatch: return Error.UnreachableCatch;
        case SysError.UnreachableCode: return Error.UnreachableCode;
        case SysError.UnreferencedLabel: return Error.UnreferencedLabel;
        case SysError.UselessComparisonWithIntegerLiteral: return Error.VacuousIntegralComp;
        case SysError.UseOfNullPointer: return Error.UseOfNullPointer;
        case SysError.UseOfPossiblyNullPointer: return Error.UseOfPossiblyNullPointer;
        case SysError.UseSwitchInsteadOfAttribute: return Error.UseSwitchInsteadOfAttribute;
        case SysError.ValConstraintNotSatisfied: return Error.ValConstraintNotSatisfied;
        case SysError.ValueTypeLayoutCycle: return Error.StructLayoutCycle;
        case SysError.ValueTypeIsAlreadyInvariant: return Error.ValueTypeIsAlreadyInvariant;
        case SysError.ValueTypeIsAlreadyNonNull: return Error.ValueTypeIsAlreadyNonNull;
        case SysError.VoidError: return Error.VoidError;
        case SysError.VolatileAndReadonly: return Error.VolatileAndReadonly;
        case SysError.VolatileByRef: return Error.VolatileByRef;
        case SysError.VolatileNonWordSize: return Error.VolatileStruct;
        case SysError.Warning: return Error.Warning;
        case SysError.Win32ResourceFileNotRead: return Error.Win32ResourceFileNotRead;
        case SysError.Win32IconFileNotRead: return Error.Win32IconFileNotRead;
        case SysError.WrongKindOfMember: return Error.BadSKknown;
        case SysError.WrongNumberOfArgumentsForDelegate: return Error.BadDelArgCount;
        case SysError.WrongNumberOfIndices: return Error.BadIndexCount;
        case SysError.WrongReturnTypeForIterator: return Error.BadIteratorReturn;

        case SysError.UseDefViolation: return Error.UseDefViolation;
        case SysError.UseDefViolationOut: return Error.UseDefViolationOut;
        case SysError.UseDefViolationField: return Error.UseDefViolationField;
        case SysError.UseDefViolationThis: return Error.UseDefViolationThis;
        case SysError.ReturnExpected: return Error.ReturnExpected;
        case SysError.ParamUnassigned: return Error.ParamUnassigned;
        case SysError.UnreferencedVar: return Error.UnreferencedVar;
        case SysError.UnreferencedVarAssg: return Error.UnreferencedVarAssg;
        case SysError.StoreIntoLessDelayedLocation: return Error.StoreIntoLessDelayedLocation;

          // MB -- 09/11/2004
        case SysError.CannotCoerceNullToNonNullType: return Error.CannotCoerceNullToNonNullType;
        case SysError.CoercionToNonNullTypeMightFail: return Error.CoercionToNonNullTypeMightFail;
        case SysError.ReceiverMightBeNull: return Error.ReceiverMightBeNull;
        case SysError.UnnecessaryNonNullCoercion: return Error.UnnecessaryNonNullCoercion;
        case SysError.OnlyStructsAndClassesCanHaveInvariants: return Error.OnlyStructsAndClassesCanHaveInvariants;
        case SysError.UpToMustBeSuperType: return Error.UpToMustBeSuperType;
        case SysError.UpToMustBeClass: return Error.UpToMustBeClass;
        case SysError.ExpectedLeftParenthesis: return Error.ExpectedLeftParenthesis;
        case SysError.MustSupportComprehension: return Error.MustSupportComprehension;
        case SysError.MustSupportReductionXXXXXXXXXXXX: return Error.MustSupportReductionXXXXXXXXXXXX;
        case SysError.MustResolveToType: return Error.MustResolveToType;
        case SysError.MemberMustBePureForMethodContract: return Error.MemberMustBePureForMethodContract;
        case SysError.RequiresNotAllowedInOverride: return Error.RequiresNotAllowedInOverride;
        case SysError.ContractNotAllowedInExplicitInterfaceImplementation: return Error.ContractNotAllowedInExplicitInterfaceImplementation;
        case SysError.CannotAddThrowsSet: return Error.CannotAddThrowsSet;
        case SysError.CannotWeakenThrowsSet: return Error.CannotWeakenThrowsSet;
        case SysError.DuplicateThrowsType: return Error.DuplicateThrowsType;
        case SysError.UncheckedExceptionInThrowsClause: return Error.UncheckedExceptionInThrowsClause;
        case SysError.RequiresNotAllowedInInterfaceImplementation: return Error.RequiresNotAllowedInInterfaceImplementation;
        case SysError.EnsuresInInterfaceNotInMethod: return Error.EnsuresInInterfaceNotInMethod;
        case SysError.ModelMemberUseNotAllowedInContext: return Error.ModelMemberUseNotAllowedInContext;
        case SysError.MemberMustBePureForInvariant: return Error.MemberMustBePureForInvariant;
        case SysError.TypeMustSupportIntCoercions: return Error.TypeMustSupportIntCoercions;
        case SysError.CannotInjectContractFromInterface: return Error.CannotInjectContractFromInterface;
        case SysError.CheckedExceptionInRequiresOtherwiseClause: return Error.CheckedExceptionInRequiresOtherwiseClause;
        case SysError.ContractInheritanceRulesViolated: return Error.ContractInheritanceRulesViolated;
        case SysError.ModifiesNotAllowedInOverride: return Error.ModifiesNotAllowedInOverride;
        case SysError.GenericError: return Error.GenericError;

        case SysError.ReceiverCannotBeNull: return Error.ReceiverCannotBeNull;
        case SysError.OtherwiseExpressionMustBeNonNull : return Error.OtherwiseExpressionMustBeNonNull;
        case SysError.OtherwiseExpressionMustBeType : return Error.OtherwiseExpressionMustBeType;

        case SysError.StrictReadonlyNotReadonly: return Error.StrictReadonlyNotReadonly;
        case SysError.StrictReadonlyStatic: return Error.StrictReadonlyStatic;
        case SysError.StrictReadonlyAssignment: return Error.StrictReadonlyAssignment;
        case SysError.StrictReadonlyMultipleAssignment: return Error.StrictReadonlyMultipleAssignment;
        case SysError.ShouldCommit: return Error.ShouldCommit;
        case SysError.ShouldCommitOnAllPaths: return Error.ShouldCommitOnAllPaths;
        case SysError.UnboxDelayedValue: return Error.UnboxDelayedValue;
        case SysError.ThrowsDelayedValue: return Error.ThrowsDelayedValue;
        case SysError.CannotUseDelayedPointer: return Error.CannotUseDelayedPointer;
        case SysError.CannotUseDelayedTypedRef: return Error.CannotUseDelayedTypedRef;

        case SysError.InvalidModifiesClause: return Error.InvalidModifiesClause;
        case SysError.PureMethodWithOutParamUsedInContract: return Error.PureMethodWithOutParamUsedInContract;
        case SysError.PureMethodCannotHaveRefParam: return Error.PureMethodCannotHaveRefParam;
        case SysError.ReadsWithoutPure: return Error.ReadsWithoutPure;
        case SysError.InconsistentPurityAttributes: return Error.InconsistentPurityAttributes;
        case SysError.PureOwnedNotAllowed: return Error.PureOwnedNotAllowed;

      }
      return Error.UnexpectedToken;
    }    
Exemplo n.º 3
0
 public override void HandleError(Node offendingNode, SysError error, params string[] messageParameters) {
   if (this.ErrorHandler == null) return;
   ((ErrorHandler)this.ErrorHandler).currentType = this.currentType;
   ((ErrorHandler)this.ErrorHandler).refOrOutAddress = this.refOrOutAddress;
   this.ErrorHandler.HandleError(offendingNode, error, messageParameters);
 }