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

Unified Diff: lib/compiler/implementation/compiler.dart

Issue 10855262: Make patching of classes lazy. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | lib/compiler/implementation/scanner/class_element_parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/compiler.dart
diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
index 02bdebe1cdeedb7544de193cb0afd26726f0a8f7..0eebdf8f6597e25a051422cf080e17a0614ae01d 100644
--- a/lib/compiler/implementation/compiler.dart
+++ b/lib/compiler/implementation/compiler.dart
@@ -381,19 +381,6 @@ class Compiler implements DiagnosticListener {
patchParser.patchLibrary(patchUri, library);
// We allow foreign functions in patched libraries.
addForeignFunctions(library); // Is safe even if already added.
- // TODO(lrn): Make this lazy.
- applyClassPatches(library);
- }
- }
-
- void applyClassPatches(LibraryElement library) {
- for (Element element in library.localMembers) {
- if (element.isClass()) {
- ClassElement classElement = element;
- if (classElement.isPatched) {
- applyClassPatch(classElement, classElement.patch);
- }
- }
}
}
@@ -481,16 +468,6 @@ class Compiler implements DiagnosticListener {
internalError("Cannot overwrite existing '"
"${originalElement.name.slowToString()}' with non-patch.");
}
- if (originalElement is PartialClassElement) {
- // Only happens when patching a library. Dart does not, yet, have nested
- // classes.
- if (patchElement is! PartialClassElement) {
- internalError("Trying to patch class with non-class",
- element:originalElement);
- }
- applyClassPatch(originalElement, patchElement);
- return;
- }
if (originalElement is! FunctionElement) {
// TODO(lrn): Handle class declarations too.
internalError("Can only patch functions", element: originalElement);
@@ -527,18 +504,6 @@ class Compiler implements DiagnosticListener {
element.setPatch(patchElement);
}
- void applyClassPatch(PartialClassElement original,
- PartialClassElement patch) {
- // Eagerly parse the class so we can patch it.
- // TODO(lrn): Perhaps find a way to delay parsing until the class is needed,
- // i.e., until [parseNode] is called on [original].
- ClassNode node = original.parseNode(this);
- // Parse patch class with "patch" parser.
- ClassNode patchNode = patchParser.parsePatchClassNode(patch);
- Link<Element> patches = patch.localMembers;
- applyContainerPatch(original, patches);
- }
-
/**
* Get an [Uri] pointing to a patch for the dart: library with
* the given path. Returns null if there is no patch.
« no previous file with comments | « no previous file | lib/compiler/implementation/scanner/class_element_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698