| Index: lib/compiler/implementation/compiler.dart
|
| diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
|
| index a9c6928b8e558b95d859de3a91669c807d94f90d..4db12997f23a6c5a2772cd069f6b673a2ad71035 100644
|
| --- a/lib/compiler/implementation/compiler.dart
|
| +++ b/lib/compiler/implementation/compiler.dart
|
| @@ -396,105 +396,6 @@ class Compiler implements DiagnosticListener {
|
| }
|
| }
|
|
|
| - void applyContainerPatch(ScopeContainerElement original,
|
| - Link<Element> patches) {
|
| - while (!patches.isEmpty()) {
|
| - Element patchElement = patches.head;
|
| - Element originalElement = original.localLookup(patchElement.name);
|
| - if (patchElement.isAccessor() && originalElement !== null) {
|
| - if (originalElement.kind !== ElementKind.ABSTRACT_FIELD) {
|
| - internalError("Cannot patch non-getter/setter with getter/setter",
|
| - element: originalElement);
|
| - }
|
| - AbstractFieldElement originalField = originalElement;
|
| - if (patchElement.isGetter()) {
|
| - originalElement = originalField.getter;
|
| - } else {
|
| - originalElement = originalField.setter;
|
| - }
|
| - }
|
| - if (originalElement === null) {
|
| - if (isPatchElement(patchElement)) {
|
| - internalError("Cannot patch non-existing member '"
|
| - "${patchElement.name.slowToString()}'.");
|
| - }
|
| - } else {
|
| - patchMember(originalElement, patchElement);
|
| - }
|
| - patches = patches.tail;
|
| - }
|
| - }
|
| -
|
| - bool isPatchElement(Element element) {
|
| - // TODO(lrn): More checks needed if we introduce metadata for real.
|
| - // In that case, it must have the identifier "native" as metadata.
|
| - for (Link link = element.metadata; !link.isEmpty(); link = link.tail) {
|
| - if (link.head is PatchMetadataAnnotation) return true;
|
| - }
|
| - return false;
|
| - }
|
| -
|
| - Element clonePatch(Element patchElement, Element enclosing) {
|
| - // The original library does not have an element with the same name
|
| - // as the patch library element.
|
| - // In this case, the patch library element must not be marked as "patch",
|
| - // and its name must make it private.
|
| - if (!patchElement.name.isPrivate()) {
|
| - internalError("Cannot add non-private member '"
|
| - "${patchElement.name.slowToString()}' from patch.");
|
| - }
|
| - Element override =
|
| - new CompilationUnitOverrideElement(patchElement.getCompilationUnit(),
|
| - enclosing);
|
| - return patchElement.cloneTo(override, this);
|
| - }
|
| -
|
| - void patchMember(Element originalElement, Element patchElement) {
|
| - // The original library has an element with the same name as the patch
|
| - // library element.
|
| - // In this case, the patch library element must be a function marked as
|
| - // "patch" and it must have the same signature as the function it patches.
|
| - if (!isPatchElement(patchElement)) {
|
| - internalError("Cannot overwrite existing '"
|
| - "${originalElement.name.slowToString()}' with non-patch.");
|
| - }
|
| - if (originalElement is! FunctionElement) {
|
| - // TODO(lrn): Handle class declarations too.
|
| - internalError("Can only patch functions", element: originalElement);
|
| - }
|
| - FunctionElement original = originalElement;
|
| - if (!original.modifiers.isExternal()) {
|
| - internalError("Can only patch external functions.", element: original);
|
| - }
|
| - if (patchElement is! FunctionElement ||
|
| - !patchSignatureMatches(original, patchElement)) {
|
| - internalError("Can only patch functions with matching signatures",
|
| - element: original);
|
| - }
|
| - applyFunctionPatch(original, patchElement);
|
| - }
|
| -
|
| - bool patchSignatureMatches(FunctionElement original, FunctionElement patch) {
|
| - // TODO(lrn): Check that patches actually match the signature of
|
| - // the function it's patching.
|
| - return true;
|
| - }
|
| -
|
| - void applyFunctionPatch(FunctionElement element,
|
| - FunctionElement patchElement) {
|
| - if (element.isPatched) {
|
| - internalError("Trying to patch a function more than once.",
|
| - element: element);
|
| - }
|
| - if (element.cachedNode !== null) {
|
| - internalError("Trying to patch an already compiled function.",
|
| - element: element);
|
| - }
|
| - // Don't just assign the patch field. This also updates the cachedNode.
|
| - element.setPatch(patchElement);
|
| - patchElement.origin = element;
|
| - }
|
| -
|
| /**
|
| * Get an [Uri] pointing to a patch for the dart: library with
|
| * the given path. Returns null if there is no patch.
|
|
|