Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1329)

Unified Diff: dart/site/try/src/caching_compiler.dart

Issue 197923002: Mock up code completion. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Too many changes to summarize in one line. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dart/site/try/src/caching_compiler.dart
diff --git a/dart/tests/compiler/dart2js/memory_compiler.dart b/dart/site/try/src/caching_compiler.dart
similarity index 55%
copy from dart/tests/compiler/dart2js/memory_compiler.dart
copy to dart/site/try/src/caching_compiler.dart
index 392f51b6bf3a36251bc7e48f634c42bc6fd82ef4..a64f7843a0803a507d0a27d4f73341f02c32e8e0 100644
--- a/dart/tests/compiler/dart2js/memory_compiler.dart
+++ b/dart/site/try/src/caching_compiler.dart
@@ -2,97 +2,34 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library dart2js.test.memory_compiler;
+library trydart.caching_compiler;
-import 'memory_source_file_helper.dart';
+import 'package:compiler/compiler.dart' show
kasperl 2014/03/24 10:32:51 This is "weird" file. Maybe add a comment that exp
ahe 2014/03/24 15:20:23 Done.
+ CompilerOutputProvider,
+ Diagnostic,
+ DiagnosticHandler;
-import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
- show NullSink;
+import 'package:compiler/implementation/apiimpl.dart' show
+ Compiler;
-import '../../../sdk/lib/_internal/compiler/compiler.dart'
- show Diagnostic, DiagnosticHandler, CompilerOutputProvider;
-
-import 'dart:async';
-
-import '../../../sdk/lib/_internal/compiler/implementation/mirrors/source_mirrors.dart';
-import '../../../sdk/lib/_internal/compiler/implementation/mirrors/analyze.dart';
-
-class DiagnosticMessage {
- final Uri uri;
- final int begin;
- final int end;
- final String message;
- final Diagnostic kind;
-
- DiagnosticMessage(this.uri, this.begin, this.end, this.message, this.kind);
-
- String toString() => '$uri:$begin:$end:$message:$kind';
+abstract class SourceFileProvider {}
+class FormattingDiagnosticHandler {
+ FormattingDiagnosticHandler(a);
}
-
-class DiagnosticCollector {
- List<DiagnosticMessage> messages = <DiagnosticMessage>[];
-
- void call(Uri uri, int begin, int end, String message,
- Diagnostic kind) {
- messages.add(new DiagnosticMessage(uri, begin, end, message, kind));
- }
-
- Iterable<DiagnosticMessage> filterMessagesByKind(Diagnostic kind) {
- return messages.where(
- (DiagnosticMessage message) => message.kind == kind);
- }
-
- Iterable<DiagnosticMessage> get errors {
- return filterMessagesByKind(Diagnostic.ERROR);
- }
-
- Iterable<DiagnosticMessage> get warnings {
- return filterMessagesByKind(Diagnostic.WARNING);
- }
-
- Iterable<DiagnosticMessage> get hints {
- return filterMessagesByKind(Diagnostic.HINT);
- }
-
- Iterable<DiagnosticMessage> get infos {
- return filterMessagesByKind(Diagnostic.INFO);
- }
+abstract class Platform {
+ static var script;
+ static var packageRoot;
}
-
-class BufferedEventSink implements EventSink<String> {
- StringBuffer sb = new StringBuffer();
- String text;
-
- void add(String event) {
- sb.write(event);
- }
-
- void addError(errorEvent, [StackTrace stackTrace]) {
- // Do not support this.
- }
-
- void close() {
- text = sb.toString();
- sb = null;
- }
+class MemorySourceFileProvider extends SourceFileProvider {
+ var readStringFromUri;
+ var memorySourceFiles;
+ MemorySourceFileProvider(a);
}
-
-class OutputCollector {
- Map<String, Map<String, BufferedEventSink>> outputMap = {};
-
- EventSink<String> call(String name, String extension) {
- Map<String, BufferedEventSink> sinkMap =
- outputMap.putIfAbsent(extension, () => {});
- return sinkMap.putIfAbsent(name, () => new BufferedEventSink());
- }
-
- String getOutput(String name, String extension) {
- Map<String, BufferedEventSink> sinkMap = outputMap[extension];
- if (sinkMap == null) return null;
- BufferedEventSink sink = sinkMap[name];
- return sink != null ? sink.text : null;
- }
+class NullSink extends EventSink {
+ NullSink(a);
}
+var expando;
+abstract class EventSink<T> {}
DiagnosticHandler createDiagnosticHandler(DiagnosticHandler diagnosticHandler,
SourceFileProvider provider,
@@ -114,9 +51,6 @@ DiagnosticHandler createDiagnosticHandler(DiagnosticHandler diagnosticHandler,
return handler;
}
-Expando<MemorySourceFileProvider> expando =
- new Expando<MemorySourceFileProvider>();
-
Compiler compilerFor(Map<String,String> memorySourceFiles,
{DiagnosticHandler diagnosticHandler,
CompilerOutputProvider outputProvider,
@@ -196,24 +130,3 @@ Compiler compilerFor(Map<String,String> memorySourceFiles,
}
return compiler;
}
-
-Future<MirrorSystem> mirrorSystemFor(Map<String,String> memorySourceFiles,
- {DiagnosticHandler diagnosticHandler,
- List<String> options: const [],
- bool showDiagnostics: true}) {
- Uri libraryRoot = Uri.base.resolve('sdk/');
- Uri packageRoot = Uri.base.resolve('${Platform.packageRoot}/');
- Uri script = Uri.base.resolveUri(Platform.script);
-
- var provider = new MemorySourceFileProvider(memorySourceFiles);
- var handler =
- createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics);
-
- List<Uri> libraries = <Uri>[];
- memorySourceFiles.forEach((String path, _) {
- libraries.add(new Uri(scheme: 'memory', path: path));
- });
-
- return analyze(libraries, libraryRoot, packageRoot,
- provider, handler, options);
-}

Powered by Google App Engine
This is Rietveld 408576698