DynamicElementImplementation: return dynamic type
MemberBuilder: accept broken methods DeltaAnalyzer: Corelib types BUG= TEST= Review URL: https://chromereviews.googleplex.com/3531013 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@133 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -51,6 +51,7 @@ import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -1089,4 +1090,28 @@ public class DartCompiler {
|
||||
config, listener);
|
||||
return analyzer.analyze();
|
||||
}
|
||||
|
||||
public static LibraryUnit findLibrary(LibraryUnit libraryUnit, String uri,
|
||||
Set<LibraryElement> seen) {
|
||||
if (seen.contains(libraryUnit.getElement())) {
|
||||
return null;
|
||||
}
|
||||
seen.add(libraryUnit.getElement());
|
||||
for (LibraryNode src : libraryUnit.getSourcePaths()) {
|
||||
if (src.getText().equals(uri)) {
|
||||
return libraryUnit;
|
||||
}
|
||||
}
|
||||
for (LibraryUnit importedLibrary : libraryUnit.getImports()) {
|
||||
LibraryUnit unit = findLibrary(importedLibrary, uri, seen);
|
||||
if (unit != null) {
|
||||
return unit;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LibraryUnit getCoreLib(LibraryUnit libraryUnit) {
|
||||
return findLibrary(libraryUnit, "corelib.dart", new HashSet<LibraryElement>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class DynamicElementImplementation extends AbstractElement implements DynamicEle
|
||||
|
||||
@Override
|
||||
public DynamicType getType() {
|
||||
return null;
|
||||
return Types.newDynamicType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -111,6 +111,7 @@ public class MemberBuilder {
|
||||
MethodElement element = method.getSymbol();
|
||||
if (element == null) {
|
||||
switch (getMethodKind(method)) {
|
||||
case NONE:
|
||||
case CONSTRUCTOR:
|
||||
element = buildConstructor(method);
|
||||
addConstructor((ClassElement) currentHolder, (ConstructorElement) element);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
package com.google.dart.compiler;
|
||||
|
||||
import com.google.dart.compiler.ast.DartUnit;
|
||||
import com.google.dart.compiler.ast.LibraryNode;
|
||||
import com.google.dart.compiler.ast.LibraryUnit;
|
||||
import com.google.dart.compiler.resolver.LibraryElement;
|
||||
import com.google.dart.compiler.testing.TestCompilerConfiguration;
|
||||
@@ -14,7 +13,6 @@ import com.google.dart.compiler.testing.TestCompilerContext;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class DeltaBench {
|
||||
public static void main(String[] args) throws IOException {
|
||||
@@ -60,9 +58,9 @@ public class DeltaBench {
|
||||
if (incremental) {
|
||||
return;
|
||||
}
|
||||
LibraryUnit enclosingLibraryUnit = findLibrary(libraryUnit, interestingFile,
|
||||
LibraryUnit enclosingLibraryUnit = DartCompiler.findLibrary(libraryUnit, interestingFile,
|
||||
new HashSet<LibraryElement>());
|
||||
LibraryUnit coreLibraryUnit = findLibrary(libraryUnit, "object.dart",
|
||||
LibraryUnit coreLibraryUnit = DartCompiler.findLibrary(libraryUnit, "object.dart",
|
||||
new HashSet<LibraryElement>());
|
||||
DartUnit unit = null;
|
||||
for (DartUnit current : enclosingLibraryUnit.getUnits()) {
|
||||
@@ -79,24 +77,4 @@ public class DeltaBench {
|
||||
System.err.println("analyzeDelta(" + unit.getSource().getName() + ") took " +
|
||||
(System.currentTimeMillis() - start) + "ms");
|
||||
}
|
||||
|
||||
private static LibraryUnit findLibrary(LibraryUnit libraryUnit, String uri,
|
||||
Set<LibraryElement> seen) {
|
||||
if (seen.contains(libraryUnit.getElement())) {
|
||||
return null;
|
||||
}
|
||||
seen.add(libraryUnit.getElement());
|
||||
for (LibraryNode src : libraryUnit.getSourcePaths()) {
|
||||
if (src.getText().equals(uri)) {
|
||||
return libraryUnit;
|
||||
}
|
||||
}
|
||||
for (LibraryUnit importedLibrary : libraryUnit.getImports()) {
|
||||
LibraryUnit unit = findLibrary(importedLibrary, uri, seen);
|
||||
if (unit != null) {
|
||||
return unit;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ public class NegativeResolverTest extends CompilerTestCase {
|
||||
}
|
||||
|
||||
public void testBadNamedConstructorNegativeTest() {
|
||||
checkNumErrors("BadNamedConstructorNegativeTest.dart", 1);
|
||||
checkNumErrors("BadNamedConstructorNegativeTest.dart", 3);
|
||||
}
|
||||
|
||||
public void testCyclicRedirectedConstructorNegativeTest() {
|
||||
|
||||
Reference in New Issue
Block a user