public CompilerError(string code, LexicalInfo lexicalInfo, string message, Exception cause) : base(message, cause) { if (null == lexicalInfo) throw new ArgumentNullException("lexicalInfo"); _code = code; _lexicalInfo = lexicalInfo; }
public CompilerError(string code, LexicalInfo lexicalInfo, params object[] args) : base(ResourceManager.Format(code, args)) { if (null == lexicalInfo) throw new ArgumentNullException("lexicalInfo"); _code = code; _lexicalInfo = lexicalInfo; }
public IfStatement(LexicalInfo token, Expression condition, Block trueBlock, Block falseBlock) : base(token) { this.Condition = condition; this.TrueBlock = trueBlock; this.FalseBlock = falseBlock; }
protected MappedNode(CompileResults results, LexicalInfo lexicalInfo, int length) : this(results, null, results.LocationToPoint(lexicalInfo), results.LocationToPoint(lexicalInfo.Line, lexicalInfo.Column + length)) { LexicalInfo = lexicalInfo; }
public Slice(LexicalInfo lexicalInfo, Expression begin, Expression end, Expression step) : base(lexicalInfo) { this.Begin = begin; this.End = end; this.Step = step; }
public BinaryExpression(LexicalInfo lexicalInfoProvider, BinaryOperatorType operator_, Expression left, Expression right) : base(lexicalInfoProvider) { this.Operator = operator_; this.Left = left; this.Right = right; }
public CompilerMessage(LexicalInfo lexicalInfo, string code, string message, TaskErrorCategory errorCategory) { LexicalInfo = lexicalInfo; Code = code; Message = message; ErrorCategory = errorCategory; }
public static MethodInvocationExpression CreateMethodInvocationExpression(LexicalInfo li, Expression target, Expression arg) { MethodInvocationExpression mie = new MethodInvocationExpression(li); mie.Target = (Expression)target.Clone(); mie.Arguments.Add((Expression)arg.Clone()); mie.IsSynthetic = true; return mie; }
public CompilerWarning(LexicalInfo lexicalInfo, string message, string code) { if (null == message) throw new ArgumentNullException("message"); if (null == code) throw new ArgumentNullException("code"); _lexicalInfo = lexicalInfo; _message = message; _code = code; }
void OnParserError(antlr.RecognitionException error) { var location = new LexicalInfo(error.getFilename(), error.getLine(), error.getColumn()); var nvae = error as antlr.NoViableAltException; if (null != nvae) ParserError(location, nvae); else GenericParserError(location, error); }
public CompilerWarning(LexicalInfo lexicalInfo, string message) { if (null == message) { throw new ArgumentNullException("message"); } _code = "BCW0000"; _lexicalInfo = lexicalInfo; _message = Boo.Lang.ResourceManager.Format(_code, message); }
public CompilerWarning(string code, LexicalInfo lexicalInfo, params object[] args) { if (null == code) { throw new ArgumentNullException("code"); } if (null == lexicalInfo) { throw new ArgumentNullException("lexicalInfo"); } _code = code; _lexicalInfo = lexicalInfo; _message = Boo.Lang.ResourceManager.Format(code, args); }
protected TypeMemberImpl(LexicalInfo lexicalInfo) : base(lexicalInfo) { _attributes = new AttributeCollection(this); }
protected SelfLiteralExpressionImpl(LexicalInfo lexicalInfo) : base(lexicalInfo) { }
/// <summary> /// Initializes a new instance of the CompilerError class. /// </summary> /// <param name="lexicalInfo">Location of the source code that caused the error.</param> /// <param name="message">Description of the error.</param> /// <param name="cause"><see cref="Exception"/> that caused the error.</param> /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception> public CompilerError(LexicalInfo lexicalInfo, string message, Exception cause) : this("SCE0000", lexicalInfo, message, cause) { }
public Method CreateAbstractMethod(LexicalInfo lexicalInfo, IMethod baseMethod) { TypeMemberModifiers visibility = VisibilityFrom(baseMethod); return(CreateMethodFromPrototype(lexicalInfo, baseMethod, visibility | TypeMemberModifiers.Abstract)); }
public MethodInvocationExpression CreateEvalInvocation(LexicalInfo li) { return(CreateBuiltinInvocation(li, BuiltinFunction.Eval)); }
protected ExpressionPairImpl(LexicalInfo lexicalInfo, Expression first, Expression second) : base(lexicalInfo) { First = first; Second = second; }
public TypeReference CreateTypeReference(LexicalInfo li, Type type) { return CreateTypeReference(li, TypeSystemServices.Map(type)); }
protected MethodImpl(LexicalInfo lexicalInfo) : base(lexicalInfo) { _parameters = new ParameterDeclarationCollection(this); _returnTypeAttributes = new AttributeCollection(this); Body = new Block(); }
protected InterfaceDefinitionImpl(LexicalInfo lexicalInfo) : base(lexicalInfo) { }
/// <summary> /// Initializes a new instance of the CompilerError class. /// </summary> /// <param name="lexicalInfo">Location of the source code that caused the error.</param> /// <param name="cause"><see cref="Exception"/> that caused the error.</param> /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception> public CompilerError(LexicalInfo lexicalInfo, Exception cause) : this(lexicalInfo, cause.Message, cause) { }
protected YieldStatementImpl(LexicalInfo lexicalInfo, Expression expression) : base(lexicalInfo) { Expression = expression; }
void ParserError(LexicalInfo data, antlr.NoViableAltException error) { string msg = Boo.ResourceManager.Format("NoViableAltException", error.token.getText()); _context.Errors.Add(new Error(data, msg, error)); }
/// <summary> /// Initializes a new instance of the CompilerError class. /// </summary> /// <param name="code">String id of the error.</param> /// <param name="lexicalInfo">Location of the source code that caused the error.</param> /// <param name="isParserError">True if error was found by <see cref="Parser"/>.</param> /// <param name="args">Formatting items used to create an error message.</param> /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception> public CompilerError(string code, LexicalInfo lexicalInfo, bool isParserError, params object[] args) : base(ErrorCodes.Format(code, args)) { _lexicalInfo = lexicalInfo ?? throw new ArgumentNullException(nameof(lexicalInfo)); IsParserError = isParserError; _code = code; }
protected ExpressionPairImpl(LexicalInfo lexicalInfo) : base(lexicalInfo) { }
public SelfLiteralExpression CreateSelfReference(LexicalInfo location, IType expressionType) { var reference = CreateSelfReference(expressionType); reference.LexicalInfo = location; return reference; }
protected IfStatementImpl(LexicalInfo lexicalInfo, Expression expression, Block trueBlock, Block falseBlock) : base(lexicalInfo) { Expression = expression; TrueBlock = trueBlock; FalseBlock = falseBlock; }
public RaiseStatement RaiseException(LexicalInfo lexicalInfo, IConstructor exceptionConstructor, params Expression[] args) { Debug.Assert(TypeSystemServices.IsValidException(exceptionConstructor.DeclaringType)); return new RaiseStatement(lexicalInfo, CreateConstructorInvocation(lexicalInfo, exceptionConstructor, args)); }
public Expression CreateInitValueType(LexicalInfo li, ReferenceExpression target) { var mie = CreateBuiltinInvocation(li, BuiltinFunction.InitValueType); mie.Arguments.Add(target); return mie; }
public ReferenceExpression CreateReference(LexicalInfo li, System.Type type) { return(CreateReference(li, TypeSystemServices.Map(type))); }
public MemberReferenceExpression CreateMemberReference(LexicalInfo li, Expression target, IMember member) { MemberReferenceExpression expression = CreateMemberReference(target, member); expression.LexicalInfo = li; return expression; }
public Statement CreateFieldAssignment(LexicalInfo lexicalInfo, IField fieldEntity, Expression initializer) { return(new ExpressionStatement(lexicalInfo, CreateFieldAssignmentExpression(fieldEntity, initializer))); }
public Method CreateMethodFromPrototype(LexicalInfo location, IMethod baseMethod, TypeMemberModifiers newModifiers, string newMethodName) { var method = new Method(location); method.Name = newMethodName; method.Modifiers = newModifiers; method.IsSynthetic = true; var optionalTypeMappings = DeclareGenericParametersFromPrototype(method, baseMethod); var typeReferenceFactory = optionalTypeMappings != null ? new MappedTypeReferenceFactory(TypeReferenceFactory, optionalTypeMappings) : TypeReferenceFactory; _typeReferenceFactory.With(typeReferenceFactory, ()=> { DeclareParameters(method, baseMethod.GetParameters(), baseMethod.IsStatic ? 0 : 1); method.ReturnType = CreateTypeReference(baseMethod.ReturnType); }); EnsureEntityFor(method); return method; }
/// <summary> /// Initializes a new instance of the CompilerError class. /// </summary> /// <param name="lexicalInfo">Location of the source code that caused the error.</param> /// <param name="message">Description of the error.</param> /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception> public CompilerError(LexicalInfo lexicalInfo, string message) : this(lexicalInfo, message, null) { }
public MethodInvocationExpression CreateMethodInvocation(LexicalInfo li, IMethod staticMethod, Expression arg0, Expression arg1, Expression arg2) { MethodInvocationExpression expression = CreateMethodInvocation(staticMethod, arg0, arg1, arg2); expression.LexicalInfo = li; return expression; }
/// <summary> /// Initializes a new instance of the CompilerError class. /// </summary> /// <param name="code">String id of the error.</param> /// <param name="lexicalInfo">Location of the source code that caused the error.</param> /// <param name="message">Description of the error.</param> /// <param name="cause"><see cref="Exception"/> that caused the error.</param> /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception> public CompilerError(string code, LexicalInfo lexicalInfo, string message, Exception cause) : base(message, cause) { _lexicalInfo = lexicalInfo ?? throw new ArgumentNullException(nameof(lexicalInfo)); _code = code; }
public Expression CreateMethodReference(LexicalInfo lexicalInfo, IMethod method) { var e = CreateMethodReference(method); e.LexicalInfo = lexicalInfo; return e; }
protected void EmitRunProcess(CompileContext context, TypeInfo procType, bool setGuidOnProc, LexicalInfo lexInfo, bool loadVariables) { if (context.Type == null || context.ILGenerator == null) { return; //Are at top level and so can't run the process } ILGenerator il = context.ILGenerator; if (loadVariables) { foreach (string paramName in procType.ConstructorParameters) { il.Emit(OpCodes.Ldloc, context.Type.GetLocal(paramName)); } } LocalBuilder loc = il.DeclareLocal(typeof(ProcessBase)); il.Emit(OpCodes.Newobj, procType.Constructor); il.Emit(OpCodes.Stloc, loc); il.Emit(OpCodes.Ldloc, loc); il.Emit(OpCodes.Ldarg_0); //load the "this" pointer //The current process doesn't have a restrict or relabel method, no reason for it //to continue living, set the parent process of the new proc as our own parent process if (!context.Type.IsPreProcessed && !context.Type.IsRestricted && !context.Type.MustLiveOn) { il.Emit(OpCodes.Call, MethodResolver.GetMethod(typeof(ProcessBase), "get_Parent")); } il.Emit(OpCodes.Call, MethodResolver.GetMethod(typeof(ProcessBase), "set_Parent")); if (setGuidOnProc) { il.Emit(OpCodes.Ldloc, loc); il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Call, typeof(ProcessBase).GetMethod("get_SetID")); il.Emit(OpCodes.Call, typeof(ProcessBase).GetMethod("set_SetID")); } il.Emit(OpCodes.Ldloc, loc); if (context.Options.Debug && lexInfo != null) { //context.MarkSequencePoint(lexInfo); } il.Emit(OpCodes.Call, MethodResolver.GetMethod(typeof(ProcessBase), "Run")); }
public ReferenceExpression CreateReference(LexicalInfo info, IType type) { var expression = CreateReference(type); expression.LexicalInfo = info; return expression; }
protected IfStatementImpl(LexicalInfo lexicalInfo) : base(lexicalInfo) { }
/// <summary> /// Initializes a new instance of the CompilerError class. /// </summary> /// <param name="code">String id of the error.</param> /// <param name="lexicalInfo">Location of the source code that caused the error.</param> /// <param name="cause"><see cref="Exception"/> that caused the error.</param> /// <param name="args">Formatting items used to create an error message.</param> /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception> public CompilerError(string code, LexicalInfo lexicalInfo, Exception cause, params object[] args) : base(ErrorCodes.Format(code, args), cause) { _code = code; _lexicalInfo = lexicalInfo ?? throw new ArgumentNullException(nameof(lexicalInfo)); }
public Expression CreateInitValueType(LexicalInfo li, InternalLocal local) { return CreateInitValueType(li, CreateReference(local)); }
private static MethodInvocationExpression NewAddInvocation(LexicalInfo location, ReferenceExpression target, params Expression[] args) { return(new MethodInvocationExpression(location, new MemberReferenceExpression(target.CloneNode(), "Add"), args)); }
public Method CreateMethodFromPrototype(LexicalInfo lexicalInfo, IMethod baseMethod, TypeMemberModifiers newModifiers) { return CreateMethodFromPrototype(lexicalInfo, baseMethod, newModifiers, baseMethod.Name); }
protected void AddCompilerError(LexicalInfo lexicalInfo, string msg) { Errors.Add(CompilerErrorFactory.CustomError(lexicalInfo, msg)); }
public MethodInvocationExpression CreateMethodInvocation(LexicalInfo li, Expression target, IMethod tag, Expression arg) { MethodInvocationExpression mie = CreateMethodInvocation(target, tag, arg); mie.LexicalInfo = li; return mie; }
public Method CreateMethodFromPrototype(LexicalInfo lexicalInfo, IMethod baseMethod, TypeMemberModifiers newModifiers) { return(CreateMethodFromPrototype(lexicalInfo, baseMethod, newModifiers, baseMethod.Name)); }
public MethodInvocationExpression CreateMethodInvocation(LexicalInfo li, Expression target, IMethod entity) { MethodInvocationExpression expression = CreateMethodInvocation(target, entity); expression.LexicalInfo = li; return expression; }
public RaiseStatement RaiseException(LexicalInfo lexicalInfo, IConstructor exceptionConstructor, params Expression[] args) { Debug.Assert(TypeSystemServices.IsValidException(exceptionConstructor.DeclaringType)); return(new RaiseStatement(lexicalInfo, CreateConstructorInvocation(lexicalInfo, exceptionConstructor, args))); }
public MemberReferenceExpression CreateReference(LexicalInfo li, Field field) { MemberReferenceExpression e = CreateReference(field); e.LexicalInfo = li; return e; }
public Expression CreateDefaultInitializer(LexicalInfo li, ReferenceExpression target, IType type) { return(type.IsValueType ? CreateInitValueType(li, target) : CreateAssignment(li, target, CreateNullLiteral())); }
public ReferenceExpression CreateReference(LexicalInfo li, System.Type type) { return CreateReference(li, TypeSystemServices.Map(type)); }
public Expression CreateDefaultInitializer(LexicalInfo li, InternalLocal local) { return(CreateDefaultInitializer(li, CreateReference(local), local.Type)); }
public Statement CreateSwitch(LexicalInfo li, Expression offset, IEnumerable<LabelStatement> labels) { offset.LexicalInfo = li; return CreateSwitch(offset, labels); }
public Expression CreateInitValueType(LexicalInfo li, InternalLocal local) { return(CreateInitValueType(li, CreateReference(local))); }
public TypeReference CreateTypeReference(LexicalInfo li, IType type) { TypeReference reference = CreateTypeReference(type); reference.LexicalInfo = li; return reference; }
public Statement CreateSwitch(LexicalInfo li, Expression offset, IEnumerable <LabelStatement> labels) { offset.LexicalInfo = li; return(CreateSwitch(offset, labels)); }
private static MethodInvocationExpression CreateBuiltinInvocation(LexicalInfo li, BuiltinFunction builtin) { return new MethodInvocationExpression(li) { Target = CreateBuiltinReference(builtin) }; }
public TypeReference CreateTypeReference(LexicalInfo li, Type type) { return(CreateTypeReference(li, TypeSystemServices.Map(type))); }