Пример #1
0
		public CompilerError(string code, LexicalInfo lexicalInfo, string message, Exception cause) : base(message, cause)
		{
			if (null == lexicalInfo)
				throw new ArgumentNullException("lexicalInfo");
			_code = code;
			_lexicalInfo = lexicalInfo;
		}
Пример #2
0
		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;
		}
Пример #3
0
 public IfStatement(LexicalInfo token, Expression condition, Block trueBlock, Block falseBlock)
     : base(token)
 {
     this.Condition = condition;
     this.TrueBlock = trueBlock;
     this.FalseBlock = falseBlock;
 }
Пример #4
0
 protected MappedNode(CompileResults results, LexicalInfo lexicalInfo, int length)
     : this(results, null,
         results.LocationToPoint(lexicalInfo),
         results.LocationToPoint(lexicalInfo.Line, lexicalInfo.Column + length))
 {
     LexicalInfo = lexicalInfo;
 }
Пример #5
0
 public Slice(LexicalInfo lexicalInfo, Expression begin, Expression end, Expression step)
     : base(lexicalInfo)
 {
     this.Begin = begin;
     this.End = end;
     this.Step = step;
 }
Пример #6
0
 public BinaryExpression(LexicalInfo lexicalInfoProvider, BinaryOperatorType operator_, Expression left, Expression right)
     : base(lexicalInfoProvider)
 {
     this.Operator = operator_;
     this.Left = left;
     this.Right = right;
 }
Пример #7
0
 public CompilerMessage(LexicalInfo lexicalInfo, string code, string message, TaskErrorCategory errorCategory)
 {
     LexicalInfo = lexicalInfo;
     Code = code;
     Message = message;
     ErrorCategory = errorCategory;
 }
Пример #8
0
 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;
 }
Пример #9
0
		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);
 }
Пример #11
0
        public CompilerWarning(LexicalInfo lexicalInfo, string message)
        {
            if (null == message)
            {
                throw new ArgumentNullException("message");
            }

            _code = "BCW0000";
            _lexicalInfo = lexicalInfo;
            _message = Boo.Lang.ResourceManager.Format(_code, message);
        }
Пример #12
0
 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);
 }
Пример #13
0
 protected TypeMemberImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
     _attributes = new AttributeCollection(this);
 }
Пример #14
0
 protected SelfLiteralExpressionImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
 }
Пример #15
0
 /// <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)
 {
 }
Пример #16
0
        public Method CreateAbstractMethod(LexicalInfo lexicalInfo, IMethod baseMethod)
        {
            TypeMemberModifiers visibility = VisibilityFrom(baseMethod);

            return(CreateMethodFromPrototype(lexicalInfo, baseMethod, visibility | TypeMemberModifiers.Abstract));
        }
Пример #17
0
 public MethodInvocationExpression CreateEvalInvocation(LexicalInfo li)
 {
     return(CreateBuiltinInvocation(li, BuiltinFunction.Eval));
 }
Пример #18
0
 protected ExpressionPairImpl(LexicalInfo lexicalInfo, Expression first, Expression second) : base(lexicalInfo)
 {
     First  = first;
     Second = second;
 }
Пример #19
0
 public TypeReference CreateTypeReference(LexicalInfo li, Type type)
 {
     return CreateTypeReference(li, TypeSystemServices.Map(type));
 }
Пример #20
0
 protected MethodImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
     _parameters           = new ParameterDeclarationCollection(this);
     _returnTypeAttributes = new AttributeCollection(this);
     Body = new Block();
 }
Пример #21
0
 protected InterfaceDefinitionImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
 }
Пример #22
0
 /// <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)
 {
 }
Пример #23
0
 protected YieldStatementImpl(LexicalInfo lexicalInfo, Expression expression) : base(lexicalInfo)
 {
     Expression = expression;
 }
Пример #24
0
        void ParserError(LexicalInfo data, antlr.NoViableAltException error)
        {
            string msg = Boo.ResourceManager.Format("NoViableAltException", error.token.getText());

            _context.Errors.Add(new Error(data, msg, error));
        }
Пример #25
0
 /// <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;
 }
Пример #26
0
 protected ExpressionPairImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
 }
Пример #27
0
 public SelfLiteralExpression CreateSelfReference(LexicalInfo location, IType expressionType)
 {
     var reference = CreateSelfReference(expressionType);
     reference.LexicalInfo = location;
     return reference;
 }
Пример #28
0
 protected IfStatementImpl(LexicalInfo lexicalInfo, Expression expression, Block trueBlock, Block falseBlock) : base(lexicalInfo)
 {
     Expression = expression;
     TrueBlock  = trueBlock;
     FalseBlock = falseBlock;
 }
Пример #29
0
 public RaiseStatement RaiseException(LexicalInfo lexicalInfo, IConstructor exceptionConstructor, params Expression[] args)
 {
     Debug.Assert(TypeSystemServices.IsValidException(exceptionConstructor.DeclaringType));
     return new RaiseStatement(lexicalInfo, CreateConstructorInvocation(lexicalInfo, exceptionConstructor, args));
 }
Пример #30
0
 public Expression CreateInitValueType(LexicalInfo li, ReferenceExpression target)
 {
     var mie = CreateBuiltinInvocation(li, BuiltinFunction.InitValueType);
     mie.Arguments.Add(target);
     return mie;
 }
Пример #31
0
 public ReferenceExpression CreateReference(LexicalInfo li, System.Type type)
 {
     return(CreateReference(li, TypeSystemServices.Map(type)));
 }
Пример #32
0
 public MemberReferenceExpression CreateMemberReference(LexicalInfo li, Expression target, IMember member)
 {
     MemberReferenceExpression expression = CreateMemberReference(target, member);
     expression.LexicalInfo = li;
     return expression;
 }
Пример #33
0
 public Statement CreateFieldAssignment(LexicalInfo lexicalInfo, IField fieldEntity, Expression initializer)
 {
     return(new ExpressionStatement(lexicalInfo,
                                    CreateFieldAssignmentExpression(fieldEntity, initializer)));
 }
Пример #34
0
        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;
        }
Пример #35
0
 /// <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)
 {
 }
Пример #36
0
 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;
 }
Пример #37
0
 /// <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;
 }
Пример #38
0
 public Expression CreateMethodReference(LexicalInfo lexicalInfo, IMethod method)
 {
     var e = CreateMethodReference(method);
     e.LexicalInfo = lexicalInfo;
     return e;
 }
Пример #39
0
        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"));
        }
Пример #40
0
 public ReferenceExpression CreateReference(LexicalInfo info, IType type)
 {
     var expression = CreateReference(type);
     expression.LexicalInfo = info;
     return expression;
 }
Пример #41
0
 protected IfStatementImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
 }
Пример #42
0
 /// <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));
 }
Пример #43
0
 public Expression CreateInitValueType(LexicalInfo li, InternalLocal local)
 {
     return CreateInitValueType(li, CreateReference(local));
 }
Пример #44
0
 private static MethodInvocationExpression NewAddInvocation(LexicalInfo location, ReferenceExpression target, params Expression[] args)
 {
     return(new MethodInvocationExpression(location, new MemberReferenceExpression(target.CloneNode(), "Add"), args));
 }
Пример #45
0
 public Method CreateMethodFromPrototype(LexicalInfo lexicalInfo, IMethod baseMethod, TypeMemberModifiers newModifiers)
 {
     return CreateMethodFromPrototype(lexicalInfo, baseMethod, newModifiers, baseMethod.Name);
 }
Пример #46
0
 protected void AddCompilerError(LexicalInfo lexicalInfo, string msg)
 {
     Errors.Add(CompilerErrorFactory.CustomError(lexicalInfo, msg));
 }
Пример #47
0
 public MethodInvocationExpression CreateMethodInvocation(LexicalInfo li, Expression target, IMethod tag, Expression arg)
 {
     MethodInvocationExpression mie = CreateMethodInvocation(target, tag, arg);
     mie.LexicalInfo = li;
     return mie;
 }
Пример #48
0
 public Method CreateMethodFromPrototype(LexicalInfo lexicalInfo, IMethod baseMethod, TypeMemberModifiers newModifiers)
 {
     return(CreateMethodFromPrototype(lexicalInfo, baseMethod, newModifiers, baseMethod.Name));
 }
Пример #49
0
 public MethodInvocationExpression CreateMethodInvocation(LexicalInfo li, Expression target, IMethod entity)
 {
     MethodInvocationExpression expression = CreateMethodInvocation(target, entity);
     expression.LexicalInfo = li;
     return expression;
 }
Пример #50
0
 public RaiseStatement RaiseException(LexicalInfo lexicalInfo, IConstructor exceptionConstructor, params Expression[] args)
 {
     Debug.Assert(TypeSystemServices.IsValidException(exceptionConstructor.DeclaringType));
     return(new RaiseStatement(lexicalInfo, CreateConstructorInvocation(lexicalInfo, exceptionConstructor, args)));
 }
Пример #51
0
 public MemberReferenceExpression CreateReference(LexicalInfo li, Field field)
 {
     MemberReferenceExpression e = CreateReference(field);
     e.LexicalInfo = li;
     return e;
 }
Пример #52
0
 public Expression CreateDefaultInitializer(LexicalInfo li, ReferenceExpression target, IType type)
 {
     return(type.IsValueType
                         ? CreateInitValueType(li, target)
                         : CreateAssignment(li, target, CreateNullLiteral()));
 }
Пример #53
0
 public ReferenceExpression CreateReference(LexicalInfo li, System.Type type)
 {
     return CreateReference(li, TypeSystemServices.Map(type));
 }
Пример #54
0
 public Expression CreateDefaultInitializer(LexicalInfo li, InternalLocal local)
 {
     return(CreateDefaultInitializer(li, CreateReference(local), local.Type));
 }
Пример #55
0
 public Statement CreateSwitch(LexicalInfo li, Expression offset, IEnumerable<LabelStatement> labels)
 {
     offset.LexicalInfo = li;
     return CreateSwitch(offset, labels);
 }
Пример #56
0
 public Expression CreateInitValueType(LexicalInfo li, InternalLocal local)
 {
     return(CreateInitValueType(li, CreateReference(local)));
 }
Пример #57
0
 public TypeReference CreateTypeReference(LexicalInfo li, IType type)
 {
     TypeReference reference = CreateTypeReference(type);
     reference.LexicalInfo = li;
     return reference;
 }
Пример #58
0
 public Statement CreateSwitch(LexicalInfo li, Expression offset, IEnumerable <LabelStatement> labels)
 {
     offset.LexicalInfo = li;
     return(CreateSwitch(offset, labels));
 }
Пример #59
0
 private static MethodInvocationExpression CreateBuiltinInvocation(LexicalInfo li, BuiltinFunction builtin)
 {
     return new MethodInvocationExpression(li) { Target = CreateBuiltinReference(builtin) };
 }
Пример #60
0
 public TypeReference CreateTypeReference(LexicalInfo li, Type type)
 {
     return(CreateTypeReference(li, TypeSystemServices.Map(type)));
 }