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

Unified Diff: compiler/java/com/google/dart/compiler/backend/js/analysis/JavascriptElement.java

Issue 9479013: Remove backends. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More clean up Created 8 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
Index: compiler/java/com/google/dart/compiler/backend/js/analysis/JavascriptElement.java
diff --git a/compiler/java/com/google/dart/compiler/backend/js/analysis/JavascriptElement.java b/compiler/java/com/google/dart/compiler/backend/js/analysis/JavascriptElement.java
deleted file mode 100644
index 0604773cb4e0cac88807057130ac2c3436170c53..0000000000000000000000000000000000000000
--- a/compiler/java/com/google/dart/compiler/backend/js/analysis/JavascriptElement.java
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-package com.google.dart.compiler.backend.js.analysis;
-
-import org.mozilla.javascript.ast.AstNode;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * JavaScript element that could be any subtype of {@link AstNode}. In the cases where the element
- * is a function any members that are hung off of its prototype chain are also recorded as members.
- */
-class JavascriptElement {
- private final JavascriptElement enclosingElement;
- private JavascriptElement inheritsElement;
- private JavascriptElement inheritsInvocation;
- private boolean instantiated;
- private final boolean isVirtual;
- private List<JavascriptElement> members = null;
- private final String name;
- private final AstNode node;
- private final String qualifiedName;
-
- public JavascriptElement(JavascriptElement enclosingElement, boolean isVirtual,
- String qualifiedName, String name, AstNode node) {
- this.enclosingElement = enclosingElement;
- this.isVirtual = isVirtual;
- this.qualifiedName = qualifiedName;
- this.name = name;
- this.node = node;
- if (enclosingElement != null) {
- enclosingElement.addMember(this);
- }
- }
-
- /**
- * @param javascriptElement
- */
- private void addMember(JavascriptElement javascriptElement) {
- if (members == null) {
- members = new LinkedList<JavascriptElement>();
- }
- members.add(javascriptElement);
- }
-
- public JavascriptElement getEnclosingElement() {
- return enclosingElement;
- }
-
- public JavascriptElement getInheritsElement() {
- return inheritsElement;
- }
-
- public JavascriptElement getInheritsInvocation() {
- return inheritsInvocation;
- }
-
- /**
- * Returns the length of this element in characters.
- */
- public int getLength() {
- return node.getLength();
- }
-
- public List<JavascriptElement> getMembers() {
- if (members == null) {
- return Collections.emptyList();
- }
-
- return members;
- }
-
- public String getName() {
- return name;
- }
-
- public AstNode getNode() {
- return node;
- }
-
- public int getOffset() {
- return node.getAbsolutePosition();
- }
-
- public String getQualifiedName() {
- return qualifiedName;
- }
-
- /**
- * Returns <code>true</code> if the element was used in a new expression. For now, we assume that
- * any javascript native element is instantiated.
- */
- public boolean isInstantiated() {
- // TODO: Assume that natives are always instantiated for now
- return instantiated || isNative();
- }
-
- /**
- * Returns <code>true</code> if the element was referenced from a top-level expression but was
- * not declared. For example, we would synthesize a native member if the following top-level
- * expression is found "Array.prototype.XXX = function(){}". Array is a native JS object.
- */
- public boolean isNative() {
- return getNode() == null;
- }
-
- public boolean isVirtual() {
- return isVirtual;
- }
-
- public void setInherits(JavascriptElement inherits) {
- this.inheritsElement = inherits;
- }
-
- public void setInheritsNode(AstNode inheritsNode) {
- this.inheritsInvocation = new JavascriptElement(null,false, "", "", inheritsNode);
- }
-
- public void setInstantiated(boolean instantiated) {
- this.instantiated = instantiated;
-
- if (inheritsElement != null) {
- inheritsElement.setInstantiated(instantiated);
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698