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

Unified Diff: pkg/front_end/lib/src/fasta/target_implementation.dart

Issue 2697523002: Add accessor for getting target-specific constructor. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « pkg/front_end/lib/src/fasta/loader.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/target_implementation.dart
diff --git a/pkg/front_end/lib/src/fasta/target_implementation.dart b/pkg/front_end/lib/src/fasta/target_implementation.dart
index 4400b123ad2e394be8d782f9c0179897d85098c9..f2e2defe1c7a3b410f236bfb6b768fe89bfe6511 100644
--- a/pkg/front_end/lib/src/fasta/target_implementation.dart
+++ b/pkg/front_end/lib/src/fasta/target_implementation.dart
@@ -5,9 +5,13 @@
library fasta.target_implementation;
import 'builder/builder.dart' show
+ Builder,
ClassBuilder,
LibraryBuilder;
+import 'loader.dart' show
+ Loader;
+
import 'target.dart' show
Target;
@@ -20,6 +24,7 @@ import 'translate_uri.dart' show
/// Provides the implementation details used by a loader for a target.
abstract class TargetImplementation extends Target {
final TranslateUri uriTranslator;
+ Builder cachedCompileTimeError;
TargetImplementation(Ticker ticker, this.uriTranslator)
: super(ticker);
@@ -40,4 +45,13 @@ abstract class TargetImplementation extends Target {
void breakCycle(ClassBuilder cls);
Uri translateUri(Uri uri) => uriTranslator.translate(uri);
+
+ /// Returns a reference to the constructor used for creating a compile-time
+ /// error. The constructor is expected to accept a single argument of type
+ /// String, which is the compile-time error message.
+ Builder getCompileTimeError(Loader loader) {
+ if (cachedCompileTimeError != null) return cachedCompileTimeError;
+ return cachedCompileTimeError =
+ loader.coreLibrary.getConstructor("_CompileTimeError", isPrivate: true);
+ }
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/loader.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698