コード例 #1
1
ファイル: RuntimeErrorSink.cs プロジェクト: jcteague/ironruby
        public override void Add(SourceUnit sourceUnit, string message, SourceSpan span, int errorCode, Severity severity) {
            if (severity == Severity.Warning && !ReportWarning(_context.Verbose, errorCode)) {
                return;
            }

            CountError(severity);

            string path;
            string codeLine;
            int line = span.Start.Line;
            if (sourceUnit != null) {
                path = sourceUnit.Path;
                codeLine = (line > 0) ? sourceUnit.GetCodeLine(line) : null;
            } else {
                path = null;
                codeLine = null;
            }

            if (severity == Severity.Error || severity == Severity.FatalError) {
                throw new SyntaxError(message, path, line, span.Start.Column, codeLine);
            } else {

                if (_WriteSite == null) {
                    Interlocked.CompareExchange(
                        ref _WriteSite,
                        CallSite<Func<CallSite, object, object, object>>.Create(RubyCallAction.Make(_context, "write", 1)),
                        null
                    );
                }

                message = RubyContext.FormatErrorMessage(message, "warning", path, line, span.Start.Column, null);

                _WriteSite.Target(_WriteSite, _context.StandardErrorOutput, MutableString.CreateMutable(message));
            }
        }
コード例 #2
0
ファイル: IsDefinedExpression.cs プロジェクト: TerabyteX/main
        public IsDefinedExpression(Expression/*!*/ expression, SourceSpan location)
            : base(location)
        {
            Assert.NotNull(expression);

            _expression = expression;
        }
コード例 #3
0
        public CompoundLeftValue(List<LeftValue>/*!*/ leftValues, LeftValue unsplattedValue, SourceSpan location)
            : base(location) {
            Assert.NotNull(leftValues);

            _leftValues = leftValues;
            _unsplattedValue = unsplattedValue;
        }
コード例 #4
0
 public ConditionalExpression(Expression/*!*/ condition, Expression/*!*/ trueExpression, Expression/*!*/ falseExpression, SourceSpan location) 
     : base(location) {
     Assert.NotNull(condition, trueExpression, falseExpression);
     _condition = condition;
     _trueExpression = trueExpression;
     _falseExpression = falseExpression;
 }
コード例 #5
0
ファイル: CompiledCodeTest.cs プロジェクト: Jirapong/main
 public override void ErrorReported(ScriptSource source, string message, SourceSpan span, int errorCode, Severity severity) {
     _source = source;
     _message = message;
     _span = span;
     _errorCode = errorCode;
     //  _severity = severity;
 }
コード例 #6
0
ファイル: ElseIfClause.cs プロジェクト: mscottford/ironruby
        public ElseIfClause(Expression condition, List<Expression>/*!*/ statements, SourceSpan location)
            : base(location) {
            Assert.NotNullItems(statements);

            _statements = statements;
            _condition = condition;
        }
コード例 #7
0
ファイル: OrExpression.cs プロジェクト: atczyc/ironruby
        public OrExpression(Expression/*!*/ left, Expression/*!*/ right, SourceSpan location)
            : base(location) {
            Assert.NotNull(left, right);

            _left = left;
            _right = right;
        }
コード例 #8
0
ファイル: MemberExpression.cs プロジェクト: octavioh/ironruby
 internal override MSAst.Expression TransformSet(AstGenerator ag, SourceSpan span, MSAst.Expression right, Operators op) {
     if (op == Operators.None) {
         return ag.AddDebugInfoAndVoid(
             Binders.Set(
                 ag.BinderState,
                 typeof(object),
                 SymbolTable.IdToString(_name),
                 ag.Transform(_target),
                 right
             ),
             span
         );
     } else {
         MSAst.ParameterExpression temp = ag.GetTemporary("inplace");
         return ag.AddDebugInfo(
             Ast.Block(
                 Ast.Assign(temp, ag.Transform(_target)),
                 SetMemberOperator(ag, right, op, temp),
                 Ast.Empty()
             ),
             Span.Start,
             span.End
         );
     }
 }
コード例 #9
0
ファイル: Program.cs プロジェクト: whoisjake/Infix
 public Program(SourceSpan span, SourceSpan start, SourceSpan end, Statement body)
     : base(span)
 {
     _start = start;
     _end = end;
     _body = body;
 }
コード例 #10
0
ファイル: LocalVariable.cs プロジェクト: jschementi/iron
        internal LocalVariable(string/*!*/ name, SourceSpan location, int definitionLexicalDepth)
            : base(name, location) {
            Debug.Assert(definitionLexicalDepth >= -1);

            _definitionLexicalDepth = definitionLexicalDepth;
            _closureIndex = -1;
        }
コード例 #11
0
 public override void ErrorReported(ScriptSource source, string message, Microsoft.Scripting.SourceSpan span, int errorCode, Microsoft.Scripting.Severity severity)
 {
     Message   = message;
     ErrorCode = errorCode;
     sev       = severity;
     Span      = span;
 }
コード例 #12
0
ファイル: ClassDefinition.cs プロジェクト: TerabyteX/main
        public ClassDefinition(LexicalScope/*!*/ definedScope, ConstantVariable/*!*/ name, Expression superClass, Body/*!*/ body, SourceSpan location)
            : base(definedScope, name, body, location)
        {
            ContractUtils.RequiresNotNull(name, "name");

            _superClass = superClass;
        }
コード例 #13
0
 public BinaryExpressionNode(BinaryOperations op, ExpressionNode left, ExpressionNode right, SourceSpan sourceSpan)
     : base(sourceSpan)
 {
     this.op = op;
     this.left = left;
     this.right = right;
 }
コード例 #14
0
        public AttributeAccess(Expression/*!*/ qualifier, string/*!*/ name, SourceSpan location)
            : base(location) {
            Assert.NotNull(qualifier, name);

            _name = name + "=";
            _qualifier = qualifier;
        }
コード例 #15
0
        public SimpleAssignmentExpression(LeftValue/*!*/ left, Expression/*!*/ right, string operation, SourceSpan location)
            : base(operation, location) {
            Assert.NotNull(left, right);

            _left = left;
            _right = right;
        }
コード例 #16
0
        internal BlockExpression(Statements/*!*/ statements, SourceSpan location)
            : base(location) {
            Assert.NotNull(statements);
            Debug.Assert(statements.Count > 1);

            _statements = statements;
        }
コード例 #17
0
ファイル: AliasStatement.cs プロジェクト: jcteague/ironruby
 public AliasStatement(bool isMethodAlias, string/*!*/ newName, string/*!*/ oldName, SourceSpan location)
     : base(location) {
     Assert.NotNull(newName, oldName);
     _newName = newName;
     _oldName = oldName;
     _isMethodAlias = isMethodAlias;
 }
コード例 #18
0
ファイル: MethodCall.cs プロジェクト: jschementi/iron
        public MethodCall(Expression target, string/*!*/ methodName, Arguments args, Block block, SourceSpan location)
            : base(args, block, location) {
            Assert.NotEmpty(methodName);

            _methodName = methodName;
            _target = target;
        }
コード例 #19
0
        public ParallelAssignmentExpression(CompoundLeftValue/*!*/ lhs, CompoundRightValue/*!*/ rhs, SourceSpan location)
            : base(null, location) {
            Assert.NotNull(lhs, rhs);

            _lhs = lhs;
            _rhs = rhs;
        }
コード例 #20
0
ファイル: _ast.cs プロジェクト: rchandrashekara/main
 public override void Add(SourceUnit sourceUnit, string message, SourceSpan span, int errorCode, Severity severity) {
     if (severity == Severity.Warning) {
         PythonOps.SyntaxWarning(message, sourceUnit, span, errorCode);
     } else {
         throw PythonOps.SyntaxError(message, sourceUnit, span, errorCode);
     }
 }
コード例 #21
0
 public AssignExpressionNode(AssignOperations operation, WritableNode left, ExpressionNode value, SourceSpan sourceSpan)
     : base(sourceSpan)
 {
     this.operation = operation;
     this.left = left;
     this.value = value;
 }
コード例 #22
0
 internal SerializedScopeStatement(string name, string[] argNames, FunctionAttributes flags, SourceSpan span, string path, string[] freeVars, string[] names, string[] cellVars, string[] varNames) {
     _name = name;
     _filename = path;
     _flags = flags;
     this.SetLoc(span.Start, span.End);
     _parameterNames = argNames;
     if (freeVars != null) {
         foreach (string freeVar in freeVars) {
             AddFreeVariable(new PythonVariable(freeVar, VariableKind.Local, this), false);
         }
     }
     if (names != null) {
         foreach (string globalName in names) {
             AddGlobalVariable(new PythonVariable(globalName, VariableKind.Global, this));
         }
     }
     if (varNames != null) {
         foreach (string variable in varNames) {
             EnsureVariable(variable);
         }
     }
     if (cellVars != null) {
         foreach (string cellVar in cellVars) {
             AddCellVariable(new PythonVariable(cellVar, VariableKind.Local, this));
         }
     }
 }
コード例 #23
0
ファイル: Binary.cs プロジェクト: whoisjake/Infix
 public Binary(SourceSpan span, Operator op, Expression left, Expression right)
     : base(span)
 {
     _op = op;
     _left = left;
     _right = right;
 }
コード例 #24
0
ファイル: RescueClause.cs プロジェクト: aceptra/ironruby
 public RescueClause(CompoundRightValue type, LeftValue target, Statements statements, SourceSpan location)
     : base(location) {
     _types = type.RightValues;
     _splatType = type.SplattedValue;
     _target = target;
     _statements = statements;
 }
コード例 #25
0
ファイル: MemberExpression.cs プロジェクト: mstram/ironruby
 internal override MSAst.Expression TransformSet(SourceSpan span, MSAst.Expression right, PythonOperationKind op) {
     if (op == PythonOperationKind.None) {
         return GlobalParent.AddDebugInfoAndVoid(
             GlobalParent.Set(
                 typeof(object),
                 _name,
                 _target,
                 right
             ),
             span
         );
     } else {
         MSAst.ParameterExpression temp = Ast.Variable(typeof(object), "inplace");
         return GlobalParent.AddDebugInfo(
             Ast.Block(
                 new[] { temp },
                 Ast.Assign(temp, _target),
                 SetMemberOperator(right, op, temp),
                 AstUtils.Empty()
             ),
             Span.Start,
             span.End
         );
     }
 }
コード例 #26
0
ファイル: RangeExpression.cs プロジェクト: jxnmaomao/ironruby
 public RangeExpression(Expression/*!*/ begin, Expression/*!*/ end, bool isExclusive,SourceSpan location) 
     : base(location) {
     Assert.NotNull(begin, end);
     _begin = begin;
     _end = end;
     _isExclusive = isExclusive;
 }
コード例 #27
0
ファイル: ForLoopExpression.cs プロジェクト: jschementi/iron
        public ForLoopExpression(LexicalScope/*!*/ definedScope, Parameters/*!*/ variables, Expression/*!*/ list, Statements body, SourceSpan location)
            : base(location) {
            Assert.NotNull(definedScope, variables, list);

            _block = new BlockDefinition(definedScope, variables, body, location);
            _list = list;
        }
コード例 #28
0
 public ForLoopExpression(CompoundLeftValue/*!*/ variables, Expression/*!*/ list, Statements body, SourceSpan location)
     : base(location) {
     Assert.NotNull(variables, list);
     
     _block = new BlockDefinition(null, variables, body, location);
     _list = list;
 }
コード例 #29
0
ファイル: RescueClause.cs プロジェクト: aceptra/ironruby
 public RescueClause(Expression/*!*/ type, LeftValue target, Statements statements, SourceSpan location)
     : base(location) {
     Assert.NotNull(type);
     _types = new Expression[] { type };
     _target = target;
     _statements = statements;
 }
コード例 #30
0
        public RegularExpression(List<Expression>/*!*/ pattern, RubyRegexOptions options, bool isCondition, SourceSpan location)
            : base(location) {
            Assert.NotNull(pattern);

            _pattern = pattern;
            _options = options;
        }
コード例 #31
0
ファイル: Finalizer.cs プロジェクト: jxnmaomao/ironruby
        public Finalizer(LexicalScope/*!*/ definedScope, Statements statements, SourceSpan location)
            : base(location) {
            Assert.NotNull(definedScope);

            _definedScope = definedScope;
            _statements = statements;
        }
コード例 #32
0
        public SyntaxErrorException(string message, string path, string code, string line, SourceSpan span, int errorCode, Severity severity)
            : base(message)
        {
            ContractUtils.RequiresNotNull(message, "message");

            _span      = span;
            _severity  = severity;
            _errorCode = errorCode;

            _sourcePath = path;
            _sourceCode = code;
            _sourceLine = line;
        }
コード例 #33
0
        public void OnTraceEvent(TraceEventKind kind, string name, string sourceFileName, Microsoft.Scripting.SourceSpan sourceSpan, Microsoft.Scripting.Utils.Func <Microsoft.Scripting.IAttributesCollection> scopeCallback, object payload, object customPayload)
        {
            switch (kind)
            {
            case TraceEventKind.TracePoint:
            case TraceEventKind.FrameEnter:
            case TraceEventKind.FrameExit:
                Trace.TraceInformation("{4} at {0} Line {1} column {2}-{3}", sourceFileName, sourceSpan.Start.Line, sourceSpan.Start.Column, sourceSpan.End.Column, kind);
                if (scopeCallback != null)
                {
                    IAttributesCollection attr = scopeCallback();
                    if (attr != null)
                    {
                        Trace.TraceInformation("Attrs {0}", attr);
                    }
                }
                break;

            case TraceEventKind.Exception:
            case TraceEventKind.ExceptionUnwind:
                //Don't know what to do
                break;

            case TraceEventKind.ThreadExit:
                Trace.TraceInformation("Page completed successfully.");
                break;

            default:
                //Do nothing
                break;
            }
        }