コード例 #1
0
 public ThisAction(ParseInfo parseInfo, Scope scope, DeltinScriptParser.E_thisContext context)
 {
     ThisType = scope.GetThis();
     if (ThisType == null)
     {
         parseInfo.Script.Diagnostics.Error("Keyword 'this' cannot be used here.", DocRange.GetRange(context));
     }
 }
コード例 #2
0
 public ThisAction(ParseInfo parseInfo, Scope scope, ThisExpression context)
 {
     ThisType = scope.GetThis();
     if (ThisType == null)
     {
         parseInfo.Script.Diagnostics.Error("Keyword 'this' cannot be used here.", context.Range);
     }
 }
コード例 #3
0
        public BaseAction(ParseInfo parseInfo, Scope scope, DeltinScriptParser.E_baseContext context)
        {
            CodeType thisType = scope.GetThis();

            // Syntax error if the 'base' keyword is used outside of classes.
            if (thisType == null)
            {
                parseInfo.Script.Diagnostics.Error("Keyword 'base' cannot be used here.", DocRange.GetRange(context));
            }

            // Syntax error if the current class does not extend anything.
            else if (thisType.Extends == null)
            {
                parseInfo.Script.Diagnostics.Error("The current type does not extend a class.", DocRange.GetRange(context));
            }

            else
            {
                baseType = thisType.Extends;
            }
        }