Ejemplo n.º 1
0
        //public object Evaluate(string initializerCode)
        //{
        //    object result;
        //    if (this.Evaluate(initializerCode, null, out result))
        //        return result;
        //    return null;
        //}

        //public object Evaluate(TextReader initializerCode)
        //{
        //    object result;
        //    if (this.Evaluate(initializerCode, null, out result))
        //        return result;
        //    return null;
        //}

        //public bool Evaluate(string initializerCode, IParseErrorSink errorSink, out object result)
        //{
        //    if (initializerCode == null)
        //        throw new ArgumentNullException("initializerCode");

        //    return this.Evaluate(new StringReader(initializerCode), errorSink, out result);
        //}

        //public bool Evaluate(TextReader initializerCode, IParseErrorSink errorSink, out object result)
        //{
        //    if (initializerCode == null)
        //        throw new ArgumentNullException("initializerCode");

        //    result = null;
        //    Parser parser = new Parser();
        //    parser.ErrorSink = errorSink;
        //    InitializerNode node = parser.ParseInitializer(initializerCode);
        //    if ((node == null) || !node.Accept(ParseTreeValidatingVisitor.Current))
        //        return false;

        //    Expression<Func<SmalltalkRuntime, object, object>> lambda;
        //    RuntimeProgramInitializer code = new RuntimeProgramInitializer(node, null);
        //    var compilationResult = code.Compile(this.Runtime);
        //    if (compilationResult == null)
        //        return false;
        //    lambda = compilationResult.ExecutableCode;
        //    if (lambda == null)
        //        return false;

        //    var function = lambda.Compile();
        //    result = function(this.Runtime, null);
        //    return true;
        //}

        private void CompleteInstall(InterchangeInstallerContext installer)
        {
            installer.ErrorSink = new InstallErrorSink();
            installer.InstallMetaAnnotations = this.InstallMetaAnnotations;
            if (installer.Install())
            {
                ExecutionContext executionContext = new ExecutionContext(this.Runtime);
                installer.NameScope.ExecuteInitializers(executionContext);
            }
        }
Ejemplo n.º 2
0
        public void Install(IEnumerable <FileInInformation> fileIns)
        {
            if (fileIns == null)
            {
                throw new ArgumentNullException("fileIns");
            }

            InterchangeInstallerContext context = this.Read(fileIns);

            this.CompleteInstall(context);
        }
Ejemplo n.º 3
0
        public InterchangeInstallerContext Read(IEnumerable <FileInInformation> fileIns)
        {
            if (fileIns == null)
            {
                throw new ArgumentNullException("fileIns");
            }

            InterchangeInstallerContext installer = this.CreateInstallerContext();

            foreach (FileInInformation info in fileIns)
            {
                using (TextReader souceCodeReader = info.GetTextReader())
                {
                    InterchangeFormatProcessor processor = new InterchangeFormatProcessor(info, souceCodeReader, installer, this.VersionServicesMap);
                    processor.ProcessInterchangeFile();
                }
            }

            return(installer);
        }