Exemplo n.º 1
0
        public CompilerResults compileFromCompilationUnits(CompilerParameters parameters, CompilationUnitNode[] compilationUnits) {
            var results = new CompilerResults();
            this.context = new CompilerContext(parameters, results);
            this.statementValidator = new StatementValidator(this.context);
            this.expressionValidator = new ExpressionValidator(this.context);
            this.statementValidator.ExpressionValidator = this.expressionValidator;
            this.expressionValidator.StatementValidator = this.statementValidator;
            this.reachabilityChecker = new ReachabilityChecker(context);
            this.assignmentChecker = new AssignmentChecker(context);
            this.bytecodeGenerator = new BytecodeGenerator(context);
            
			foreach (var cu in compilationUnits) {
				context.CompilationUnits.add(cu);
			}
			doCompile();
            
            this.context = null;
            this.statementValidator = null;
            this.expressionValidator = null;
            this.reachabilityChecker = null;
            this.assignmentChecker = null;
            this.queryTranslator = null;
            this.documentationBuilder = null;
			
			if (parameters.ProgressTracker != null) {
				parameters.ProgressTracker.compilationFinished();
			}
            return results;
        }
					: super("Semantic Highlight") {
				this.editor = editor;
				this.text = text;
				this.compilationUnit = compilationUnit;
				this.typeSystem = typeSystem;
				this.annotatedTypeSystem = annotatedTypeSystem;
			}
Exemplo n.º 3
0
        private CompilationUnitNode parseCompilationUnit() {
            var compilationUnit = new CompilationUnitNode(scanner.Text) { Body = parsePackageBody(true, 0) };
			compilationUnit.StartPosition = 0;
			compilationUnit.EndPosition = sizeof(compilationUnit.Text);
			return compilationUnit;
        }
			HighlightJob(SourceEditor editor, char[] text, CompilationUnitNode compilationUnit,
					Library typeSystem, Library annotatedTypeSystem)
					: super("Semantic Highlight") {
		public String print(char[] text, CompilationUnitNode compilationUnit) {
			this.text = text;
			var sb = new StringBuilder();
			print(compilationUnit.getBody(), 0, sb);
			return sb.toString();
		}