当前位置: 首页>>代码示例>>C#>>正文


C# Context.HandleError方法代码示例

本文整理汇总了C#中Microsoft.JScript.Context.HandleError方法的典型用法代码示例。如果您正苦于以下问题:C# Context.HandleError方法的具体用法?C# Context.HandleError怎么用?C# Context.HandleError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.JScript.Context的用法示例。


在下文中一共展示了Context.HandleError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CoerceToBaseType

 internal void CoerceToBaseType(Type bt, Context errCtx){
   Object val = 0;
   AST pval = ((AST)this.value).PartiallyEvaluate();
   if (pval is ConstantWrapper)
     val = ((ConstantWrapper)pval).Evaluate();
   else
     pval.context.HandleError(JSError.NotConst);
   try{
     this.value = Convert.CoerceT(val, bt);
   }catch(Exception){
     errCtx.HandleError(JSError.TypeMismatch);
     this.value = Convert.CoerceT(0, bt);
   }
 }
开发者ID:ArildF,项目名称:masters,代码行数:14,代码来源:enumwrapper.cs

示例2: ParameterDeclaration

 internal ParameterDeclaration(Context context, String identifier, TypeExpression type, CustomAttributeList customAttributes)
   : base() {
   this.identifier = identifier;
   this.type = type == null ? new TypeExpression(new ConstantWrapper(Typeob.Object, context)) : type;
   this.context = context;
   ActivationObject current_scope = (ActivationObject)context.document.engine.Globals.ScopeStack.Peek();
   if (current_scope.name_table[this.identifier] != null)
     //Only happens if there is another parameter declarations with the same name
     context.HandleError(JSError.DuplicateName, this.identifier, current_scope is ClassScope || current_scope.fast || type != null);
   else{
     JSVariableField field = current_scope.AddNewField(this.identifier, null, 0);
     field.originalContext = context;
   }
   this.customAttributes = customAttributes;
 }
开发者ID:ArildF,项目名称:masters,代码行数:15,代码来源:parameterdeclaration.cs

示例3: ParameterDeclaration

 internal ParameterDeclaration(Context context, string identifier, TypeExpression type, CustomAttributeList customAttributes)
 {
     this.identifier = identifier;
     this.type = (type == null) ? new TypeExpression(new ConstantWrapper(Typeob.Object, context)) : type;
     this.context = context;
     ActivationObject obj2 = (ActivationObject) context.document.engine.Globals.ScopeStack.Peek();
     if (obj2.name_table[this.identifier] != null)
     {
         context.HandleError(JSError.DuplicateName, this.identifier, ((obj2 is ClassScope) || obj2.fast) || (type != null));
     }
     else
     {
         obj2.AddNewField(this.identifier, null, FieldAttributes.PrivateScope).originalContext = context;
     }
     this.customAttributes = customAttributes;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:ParameterDeclaration.cs

示例4: CoerceToBaseType

 internal void CoerceToBaseType(Type bt, Context errCtx)
 {
     object obj2 = 0;
     AST ast = ((AST) this.value).PartiallyEvaluate();
     if (ast is ConstantWrapper)
     {
         obj2 = ((ConstantWrapper) ast).Evaluate();
     }
     else
     {
         ast.context.HandleError(JSError.NotConst);
     }
     try
     {
         this._value = Microsoft.JScript.Convert.CoerceT(obj2, bt);
     }
     catch
     {
         errCtx.HandleError(JSError.TypeMismatch);
         this._value = Microsoft.JScript.Convert.CoerceT(0, bt);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:DeclaredEnumValue.cs

示例5: LiteralToNumber

 internal static Object LiteralToNumber(String str, Context context){
   //Called from the parser for integer literals
   uint r = 10;
   if (str[0] == '0' && str.Length > 1)
     if (str[1] == 'x' || str[1] == 'X')
       r = 16;
     else
       r = 8;
   Object result = Convert.parseRadix(str.ToCharArray(), r, r == 16 ? 2 : 0, 1, false);
   if (result != null){
     if (r == 8 && context != null && result is Int32 && ((int)result) > 7)
       context.HandleError(JSError.OctalLiteralsAreDeprecated);
     return result;
   }
   context.HandleError(JSError.BadOctalLiteral);
   return Convert.parseRadix(str.ToCharArray(), 10, 0, 1, false);
 }
开发者ID:ArildF,项目名称:masters,代码行数:17,代码来源:convert.cs

示例6: CheckTypeNameForCLSCompliance

 internal void CheckTypeNameForCLSCompliance(String name, String fullname, Context context){
   if (!this.isCLSCompliant)
     return;
   if (name[0] == '_'){
     context.HandleError(JSError.NonCLSCompliantType);
     return;
   }
   if (!VsaEngine.CheckIdentifierForCLSCompliance(fullname)){
     context.HandleError(JSError.NonCLSCompliantType);
     return;
   }
   if (this.typenameTable == null)
     this.typenameTable = new Hashtable(new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture), new CaseInsensitiveComparer(CultureInfo.InvariantCulture));
   if (this.typenameTable[fullname] == null)
     this.typenameTable[fullname] = fullname;
   else
     context.HandleError(JSError.NonCLSCompliantType);
 }
开发者ID:ArildF,项目名称:masters,代码行数:18,代码来源:vsaengine.cs

示例7: CheckTypeNameForCLSCompliance

 internal void CheckTypeNameForCLSCompliance(String name, String fullname, Context context){
   if (!this.isCLSCompliant)
     return;
   if (name[0] == '_'){
     context.HandleError(JSError.NonCLSCompliantType);
     return;
   }
   if (!VsaEngine.CheckIdentifierForCLSCompliance(fullname)){
     context.HandleError(JSError.NonCLSCompliantType);
     return;
   }
   if (this.typenameTable == null)
     this.typenameTable = new Hashtable(StringComparer.OrdinalIgnoreCase);
   if (this.typenameTable[fullname] == null)
     this.typenameTable[fullname] = fullname;
   else
     context.HandleError(JSError.NonCLSCompliantType);
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:18,代码来源:vsaengine.cs

示例8: ForceReportInfo

 //---------------------------------------------------------------------------------------
 // ForceReportInfo
 //
 //  Generate a parser error (info), does not change the error state in the parse
 //---------------------------------------------------------------------------------------
 private void ForceReportInfo(Context context, JSError errorId){
   Debug.Assert(context != null);
   context.HandleError(errorId);
 }
开发者ID:ArildF,项目名称:masters,代码行数:9,代码来源:jsparser.cs

示例9: ReportError

      //---------------------------------------------------------------------------------------
      // ReportError
      //
      //  Generate a parser error.
      //  The function is told whether or not next call to GetToken() should return the same
      //  token or not
      //---------------------------------------------------------------------------------------
      private void ReportError(JSError errorId, Context context, bool skipToken){
        Debug.Assert(context != null);
        int previousSeverity = this.Severity;
        this.Severity = (new JScriptException(errorId)).Severity;
        // EOF error is special and it's the last error we can possibly get
        if (JSToken.EndOfFile == context.token)
          EOFError(errorId); // EOF context is special
        else{
          // report the error if not in error condition and the
          // error for this token is not worse than the one for the
          // previous token
          if (this.goodTokensProcessed > 0 || this.Severity < previousSeverity)
            context.HandleError(errorId);

          // reset proper info
          if (skipToken)
            this.goodTokensProcessed = -1;
          else{
            this.errorToken = this.currentToken;
            this.goodTokensProcessed = 0;
          }
        }
      }
开发者ID:ArildF,项目名称:masters,代码行数:30,代码来源:jsparser.cs

示例10: CheckParameters

 internal static bool CheckParameters(ParameterInfo[] pars, IReflect[] argIRs, ASTList argAST, Context ctx, int offset, bool defaultIsUndefined, bool reportError){
   int n = argIRs.Length;
   int m = pars.Length;
   bool tooManyParams = false;
   if (n > m-offset) {n = m-offset; tooManyParams = true;}
   for (int i = 0; i < n; i++){
     IReflect formalIR = (pars[i+offset] is ParameterDeclaration) ? ((ParameterDeclaration)pars[i+offset]).ParameterIReflect : pars[i+offset].ParameterType;
     IReflect actualIR = argIRs[i];
     if (i == n-1 && ((formalIR is Type && Typeob.Array.IsAssignableFrom((Type)formalIR)) || formalIR is TypedArray) && 
     pars[i+offset].IsDefined(Typeob.ParamArrayAttribute, false)){
       tooManyParams = false;
       int k = argIRs.Length;
       if (i == k - 1){
         if (Binding.AssignmentCompatible(formalIR, argAST[i], argIRs[i], false))
           return true;
       }
       IReflect elemIR = formalIR is Type ? ((Type)formalIR).GetElementType() : ((TypedArray)formalIR).elementType;
       for (int j = i; j < k; j++)
         if (!Binding.AssignmentCompatible(elemIR, argAST[j], argIRs[j], reportError)) return false;
       return true;
     }
     if (!Binding.AssignmentCompatible(formalIR, argAST[i], actualIR, reportError)) return false;
   }
   if (tooManyParams && reportError)
     ctx.HandleError(JSError.TooManyParameters);
   if (offset == 0 && n < m && !defaultIsUndefined) //Fewer actual parameters than formal parameters
     for (int j = n; j < m; j++)
       if (pars[j].DefaultValue == System.Convert.DBNull){ //No default value specified
         if (j < m-1 || !pars[j].IsDefined(Typeob.ParamArrayAttribute, false)){
           if (reportError)
             ctx.HandleError(JSError.TooFewParameters);
           IReflect formalIR = (pars[j+offset] is ParameterDeclaration) ? ((ParameterDeclaration)pars[j+offset]).ParameterIReflect : pars[j+offset].ParameterType;
           Type formalType = formalIR as Type;
           if (formalType != null && formalType.IsValueType && !formalType.IsPrimitive && !formalType.IsEnum)
             return false; //Can't generate valid code for this since there is no general mapping from undefined to value types
         }
       }
   return true;
 }
开发者ID:ArildF,项目名称:masters,代码行数:39,代码来源:binding.cs

示例11: WarnIfObsolete

      internal static void WarnIfObsolete(MemberInfo member, Context context){
        if (member == null)
          return;
        String message = null;
        bool isError = false;
        Object[] custAttribs = member.GetCustomAttributes(Typeob.ObsoleteAttribute, false);
        if (custAttribs != null && custAttribs.Length > 0){
          ObsoleteAttribute attr = (ObsoleteAttribute)custAttribs[0];
          message =  attr.Message;
          isError = attr.IsError;
        }else{
          custAttribs = member.GetCustomAttributes(Typeob.NotRecommended, false);
          if (custAttribs != null && custAttribs.Length > 0){
            NotRecommended attr = (NotRecommended)custAttribs[0];
            message = ": " + attr.Message;
            isError = false;
          }else
            return;
        }
        context.HandleError(JSError.Deprecated, message, isError);

      }
开发者ID:ArildF,项目名称:masters,代码行数:22,代码来源:binding.cs

示例12: CheckTypeNameForCLSCompliance

 internal void CheckTypeNameForCLSCompliance(string name, string fullname, Context context)
 {
     if (this.isCLSCompliant)
     {
         if (name[0] == '_')
         {
             context.HandleError(JSError.NonCLSCompliantType);
         }
         else if (!CheckIdentifierForCLSCompliance(fullname))
         {
             context.HandleError(JSError.NonCLSCompliantType);
         }
         else
         {
             if (this.typenameTable == null)
             {
                 this.typenameTable = new Hashtable(StringComparer.OrdinalIgnoreCase);
             }
             if (this.typenameTable[fullname] == null)
             {
                 this.typenameTable[fullname] = fullname;
             }
             else
             {
                 context.HandleError(JSError.NonCLSCompliantType);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:VsaEngine.cs

示例13: LiteralToNumber

 internal static object LiteralToNumber(string str, Context context)
 {
     uint rdx = 10;
     if ((str[0] == '0') && (str.Length > 1))
     {
         if ((str[1] == 'x') || (str[1] == 'X'))
         {
             rdx = 0x10;
         }
         else
         {
             rdx = 8;
         }
     }
     object obj2 = parseRadix(str.ToCharArray(), rdx, (rdx == 0x10) ? 2 : 0, 1, false);
     if (obj2 != null)
     {
         if (((rdx == 8) && (context != null)) && ((obj2 is int) && (((int) obj2) > 7)))
         {
             context.HandleError(JSError.OctalLiteralsAreDeprecated);
         }
         return obj2;
     }
     context.HandleError(JSError.BadOctalLiteral);
     return parseRadix(str.ToCharArray(), 10, 0, 1, false);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:Convert.cs

示例14: ReportError

 private void ReportError(JSError errorId, Context context, bool skipToken)
 {
     int severity = this.Severity;
     this.Severity = new JScriptException(errorId).Severity;
     if (context.token == JSToken.EndOfFile)
     {
         this.EOFError(errorId);
     }
     else
     {
         if ((this.goodTokensProcessed > 0L) || (this.Severity < severity))
         {
             context.HandleError(errorId);
         }
         if (skipToken)
         {
             this.goodTokensProcessed = -1L;
         }
         else
         {
             this.errorToken = this.currentToken;
             this.goodTokensProcessed = 0L;
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:JSParser.cs

示例15: ForceReportInfo

 private void ForceReportInfo(Context context, JSError errorId)
 {
     context.HandleError(errorId);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:JSParser.cs


注:本文中的Microsoft.JScript.Context.HandleError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。