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

Unified Diff: pkg/front_end/lib/src/base/source.dart

Issue 2624193003: Work in progress: front end hot reload API (Closed)
Patch Set: First steel thread of functionality. Created 3 years, 11 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: pkg/front_end/lib/src/base/source.dart
diff --git a/pkg/front_end/lib/src/base/source.dart b/pkg/front_end/lib/src/base/source.dart
index 0ed4747915f61d9d45bc041f720f635fe9cb7486..a87f933bd45eff9ad90de494e2406996a00f35e4 100644
--- a/pkg/front_end/lib/src/base/source.dart
+++ b/pkg/front_end/lib/src/base/source.dart
@@ -5,6 +5,33 @@
import 'package:front_end/src/base/analysis_target.dart';
import 'package:front_end/src/base/timestamped_data.dart';
import 'package:front_end/src/base/uri_kind.dart';
+import 'package:path/path.dart' as pathos;
+
+/// Base class providing implementations for the methods in [Source] that don't
+/// require filesystem access.
+abstract class BasicSource extends Source {
+ final Uri uri;
+
+ BasicSource(this.uri);
+
+ @override
+ String get encoding => uri.toString();
+
+ @override
+ String get fullName => encoding;
+
+ @override
+ int get hashCode => uri.hashCode;
+
+ @override
+ bool get isInSystemLibrary => uri.scheme == 'dart';
+
+ @override
+ String get shortName => pathos.basename(fullName);
+
+ @override
+ bool operator ==(Object object) => object is Source && object.uri == uri;
+}
/**
* The interface `Source` defines the behavior of objects representing source code that can be

Powered by Google App Engine
This is Rietveld 408576698