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

Unified Diff: pkg/compiler/lib/src/kernel/fasta_support.dart

Issue 2907333003: Fix performance regression for checking that retricted types are not (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | pkg/front_end/lib/src/fasta/source/source_loader.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/kernel/fasta_support.dart
diff --git a/pkg/compiler/lib/src/kernel/fasta_support.dart b/pkg/compiler/lib/src/kernel/fasta_support.dart
index af3b833499166340dc5fbbff5f0f6be69122e314..b96e840f97a909288fd4b45c7fa320c64863c3af 100644
--- a/pkg/compiler/lib/src/kernel/fasta_support.dart
+++ b/pkg/compiler/lib/src/kernel/fasta_support.dart
@@ -18,10 +18,12 @@ library compiler.src.kernel.fasta_support;
import 'dart:async' show Future;
import 'dart:io' show exitCode;
+import 'package:front_end/file_system.dart';
import 'package:front_end/physical_file_system.dart';
import 'package:front_end/src/fasta/kernel/utils.dart';
-import 'package:kernel/ast.dart' show Source;
+import 'package:kernel/ast.dart' show Source, Library;
+import 'package:front_end/src/fasta/builder/builder.dart' show LibraryBuilder;
import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
import 'package:front_end/src/fasta/fasta.dart' show CompileTask;
@@ -29,6 +31,8 @@ import 'package:front_end/src/fasta/kernel/kernel_target.dart'
show KernelTarget;
import 'package:front_end/src/fasta/loader.dart' show Loader;
import 'package:front_end/src/fasta/parser/parser.dart' show optional;
+import 'package:front_end/src/fasta/source/source_loader.dart'
+ show SourceLoader;
import 'package:front_end/src/scanner/token.dart' show Token;
import 'package:front_end/src/fasta/ticker.dart' show Ticker;
import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri;
@@ -87,6 +91,10 @@ class KernelTargetForDart2js extends KernelTarget {
uriToSource);
@override
+ SourceLoader<Library> createLoader() =>
+ new SourceLoaderForDart2js<Library>(fileSystem, this);
+
+ @override
Token skipNativeClause(Token token) => _skipNative(token);
@override
@@ -99,6 +107,31 @@ class KernelTargetForDart2js extends KernelTarget {
void runBuildTransformations() {}
}
+/// Specializes [SourceLoader] to build kernel for dart2js: dart2js extends
+/// bool, int, num, double, and String in a different platform library than
+/// `dart:core`.
+class SourceLoaderForDart2js<L> extends SourceLoader<L> {
+ LibraryBuilder interceptorsLibrary;
+
+ @override
+ LibraryBuilder read(Uri uri, int charOffset,
+ {Uri fileUri, LibraryBuilder accessor, bool isPatch: false}) {
+ var library = super.read(uri, charOffset,
+ fileUri: fileUri, accessor: accessor, isPatch: isPatch);
+ if (uri.scheme == 'dart' && uri.path == '_interceptors') {
+ interceptorsLibrary = library;
+ }
+ return library;
+ }
+
+ @override
+ bool canImplementRestrictedTypes(LibraryBuilder library) =>
+ library == coreLibrary || library == interceptorsLibrary;
+
+ SourceLoaderForDart2js(FileSystem fs, KernelTarget target)
+ : super(fs, target);
+}
+
/// Specializes [DillTarget] to build kernel for dart2js: JS-specific libraries
/// are included in the SDK, and native clauses have no string parameter.
class DillTargetForDart2js extends DillTarget {
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/source/source_loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698