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)); } }
public IsDefinedExpression(Expression/*!*/ expression, SourceSpan location) : base(location) { Assert.NotNull(expression); _expression = expression; }
public CompoundLeftValue(List<LeftValue>/*!*/ leftValues, LeftValue unsplattedValue, SourceSpan location) : base(location) { Assert.NotNull(leftValues); _leftValues = leftValues; _unsplattedValue = unsplattedValue; }
public ConditionalExpression(Expression/*!*/ condition, Expression/*!*/ trueExpression, Expression/*!*/ falseExpression, SourceSpan location) : base(location) { Assert.NotNull(condition, trueExpression, falseExpression); _condition = condition; _trueExpression = trueExpression; _falseExpression = falseExpression; }
public override void ErrorReported(ScriptSource source, string message, SourceSpan span, int errorCode, Severity severity) { _source = source; _message = message; _span = span; _errorCode = errorCode; // _severity = severity; }
public ElseIfClause(Expression condition, List<Expression>/*!*/ statements, SourceSpan location) : base(location) { Assert.NotNullItems(statements); _statements = statements; _condition = condition; }
public OrExpression(Expression/*!*/ left, Expression/*!*/ right, SourceSpan location) : base(location) { Assert.NotNull(left, right); _left = left; _right = right; }
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 ); } }
public Program(SourceSpan span, SourceSpan start, SourceSpan end, Statement body) : base(span) { _start = start; _end = end; _body = body; }
internal LocalVariable(string/*!*/ name, SourceSpan location, int definitionLexicalDepth) : base(name, location) { Debug.Assert(definitionLexicalDepth >= -1); _definitionLexicalDepth = definitionLexicalDepth; _closureIndex = -1; }
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; }
public ClassDefinition(LexicalScope/*!*/ definedScope, ConstantVariable/*!*/ name, Expression superClass, Body/*!*/ body, SourceSpan location) : base(definedScope, name, body, location) { ContractUtils.RequiresNotNull(name, "name"); _superClass = superClass; }
public BinaryExpressionNode(BinaryOperations op, ExpressionNode left, ExpressionNode right, SourceSpan sourceSpan) : base(sourceSpan) { this.op = op; this.left = left; this.right = right; }
public AttributeAccess(Expression/*!*/ qualifier, string/*!*/ name, SourceSpan location) : base(location) { Assert.NotNull(qualifier, name); _name = name + "="; _qualifier = qualifier; }
public SimpleAssignmentExpression(LeftValue/*!*/ left, Expression/*!*/ right, string operation, SourceSpan location) : base(operation, location) { Assert.NotNull(left, right); _left = left; _right = right; }
internal BlockExpression(Statements/*!*/ statements, SourceSpan location) : base(location) { Assert.NotNull(statements); Debug.Assert(statements.Count > 1); _statements = statements; }
public AliasStatement(bool isMethodAlias, string/*!*/ newName, string/*!*/ oldName, SourceSpan location) : base(location) { Assert.NotNull(newName, oldName); _newName = newName; _oldName = oldName; _isMethodAlias = isMethodAlias; }
public MethodCall(Expression target, string/*!*/ methodName, Arguments args, Block block, SourceSpan location) : base(args, block, location) { Assert.NotEmpty(methodName); _methodName = methodName; _target = target; }
public ParallelAssignmentExpression(CompoundLeftValue/*!*/ lhs, CompoundRightValue/*!*/ rhs, SourceSpan location) : base(null, location) { Assert.NotNull(lhs, rhs); _lhs = lhs; _rhs = rhs; }
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); } }
public AssignExpressionNode(AssignOperations operation, WritableNode left, ExpressionNode value, SourceSpan sourceSpan) : base(sourceSpan) { this.operation = operation; this.left = left; this.value = value; }
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)); } } }
public Binary(SourceSpan span, Operator op, Expression left, Expression right) : base(span) { _op = op; _left = left; _right = right; }
public RescueClause(CompoundRightValue type, LeftValue target, Statements statements, SourceSpan location) : base(location) { _types = type.RightValues; _splatType = type.SplattedValue; _target = target; _statements = statements; }
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 ); } }
public RangeExpression(Expression/*!*/ begin, Expression/*!*/ end, bool isExclusive,SourceSpan location) : base(location) { Assert.NotNull(begin, end); _begin = begin; _end = end; _isExclusive = isExclusive; }
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; }
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; }
public RescueClause(Expression/*!*/ type, LeftValue target, Statements statements, SourceSpan location) : base(location) { Assert.NotNull(type); _types = new Expression[] { type }; _target = target; _statements = statements; }
public RegularExpression(List<Expression>/*!*/ pattern, RubyRegexOptions options, bool isCondition, SourceSpan location) : base(location) { Assert.NotNull(pattern); _pattern = pattern; _options = options; }
public Finalizer(LexicalScope/*!*/ definedScope, Statements statements, SourceSpan location) : base(location) { Assert.NotNull(definedScope); _definedScope = definedScope; _statements = statements; }
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; }
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; } }