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

Unified Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java

Issue 9633009: Use Element instead of Symbol. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
index 0c7f84bae130f3ca697c975eb6de95b6b814f6f5..239533837f103d0a46421b6610179c6793ba27c9 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -33,7 +33,6 @@ import com.google.dart.compiler.ast.DartNode;
import com.google.dart.compiler.ast.DartParameter;
import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.ast.DartUnqualifiedInvocation;
-import com.google.dart.compiler.common.Symbol;
import com.google.dart.compiler.parser.ParserErrorCode;
import com.google.dart.compiler.resolver.ClassElement;
import com.google.dart.compiler.resolver.Element;
@@ -74,15 +73,15 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
DartInvocation invocation = findInvocationSimple(unit, "f()");
assertNotNull(invocation);
// referenced Element should be resolved to MethodElement
- Element methodElement = invocation.getReferencedElement();
+ Element methodElement = invocation.getElement();
assertNotNull(methodElement);
assertSame(ElementKind.METHOD, methodElement.getKind());
- assertEquals("f", ((MethodElement) methodElement).getOriginalSymbolName());
+ assertEquals("f", ((MethodElement) methodElement).getOriginalName());
// enclosing Element of MethodElement is ClassElement
EnclosingElement classElement = methodElement.getEnclosingElement();
assertNotNull(classElement);
assertSame(ElementKind.CLASS, classElement.getKind());
- assertEquals("Test", ((ClassElement) classElement).getOriginalSymbolName());
+ assertEquals("Test", ((ClassElement) classElement).getOriginalName());
}
/**
@@ -109,10 +108,10 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
DartInvocation invocation = findInvocationSimple(unit, "f()");
assertNotNull(invocation);
// referenced Element should be resolved to MethodElement
- Element functionElement = invocation.getReferencedElement();
+ Element functionElement = invocation.getElement();
assertNotNull(functionElement);
assertSame(ElementKind.FUNCTION_OBJECT, functionElement.getKind());
- assertEquals("f", ((MethodElement) functionElement).getOriginalSymbolName());
+ assertEquals("f", ((MethodElement) functionElement).getOriginalName());
// enclosing Element of this FUNCTION_OBJECT is enclosing method
EnclosingElement enclosingMethodElement = functionElement.getEnclosingElement();
assertNotNull(enclosingMethodElement);
@@ -137,7 +136,7 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertNotNull(factory);
// this factory has name, which is allowed for normal method
assertEquals(true, factory.getName() instanceof DartIdentifier);
- assertEquals("foo", ((DartIdentifier) factory.getName()).getTargetName());
+ assertEquals("foo", ((DartIdentifier) factory.getName()).getName());
// compilation error expected
assertBadTopLevelFactoryError(libraryResult);
}
@@ -217,7 +216,7 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
// "new I.foo()" - resolved, but we produce error.
{
DartNewExpression newExpression = findNewExpression(unit, "new I.foo(0)");
- DartNode constructorNode = newExpression.getSymbol().getNode();
+ DartNode constructorNode = newExpression.getElement().getNode();
assertEquals(true, constructorNode.toSource().contains("F.foo("));
}
}
@@ -245,7 +244,7 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
DartClass classF = (DartClass) unit.getTopLevelNodes().get(1);
DartMethodDefinition methodF = (DartMethodDefinition) classF.getMembers().get(1);
DartParameter parameter = methodF.getFunction().getParameters().get(0);
- assertEquals("int", parameter.getSymbol().getType().toString());
+ assertEquals("int", parameter.getElement().getType().toString());
}
// No errors or type warnings.
assertErrors(libraryResult.getCompilationErrors());
@@ -769,9 +768,9 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
invocation = (DartUnqualifiedInvocation) stmt.getExpression();
}
// Check that unqualified foo() invocation is resolved to the top-level (library) function.
- Symbol symbol = invocation.getTarget().getSymbol();
- assertNotNull(symbol);
- assertSame(unit, symbol.getNode().getParent());
+ Element element = invocation.getTarget().getElement();
+ assertNotNull(element);
+ assertSame(unit, element.getNode().getParent());
}
/**

Powered by Google App Engine
This is Rietveld 408576698