Skip to content

Commit ce691fb

Browse files
committed
Version 0.6.7.0 .
svn merge -r 25115:25191 https://dart.googlecode.com/svn/branches/bleeding_edge trunk git-svn-id: http://dart.googlecode.com/svn/trunk@25194 260f80e4-7a28-3924-810f-c04153c831b5
2 parents 6451ace + 18f6092 commit ce691fb

File tree

133 files changed

+4622
-2292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+4622
-2292
lines changed

pkg/analyzer_experimental/lib/src/generated/ast.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15497,6 +15497,9 @@ class NodeLocator extends GeneralizingASTVisitor<Object> {
1549715497
* @return the element that was found
1549815498
*/
1549915499
ASTNode searchWithin(ASTNode node) {
15500+
if (node == null) {
15501+
return null;
15502+
}
1550015503
try {
1550115504
node.accept(this);
1550215505
} on NodeLocator_NodeFoundException catch (exception) {
@@ -16946,7 +16949,11 @@ class ASTCloner implements ASTVisitor<ASTNode> {
1694616949
BreakStatement visitBreakStatement(BreakStatement node) => new BreakStatement.full(node.keyword, clone2(node.label), node.semicolon);
1694716950
CascadeExpression visitCascadeExpression(CascadeExpression node) => new CascadeExpression.full(clone2(node.target), clone3(node.cascadeSections));
1694816951
CatchClause visitCatchClause(CatchClause node) => new CatchClause.full(node.onKeyword, clone2(node.exceptionType), node.catchKeyword, node.leftParenthesis, clone2(node.exceptionParameter), node.comma, clone2(node.stackTraceParameter), node.rightParenthesis, clone2(node.body));
16949-
ClassDeclaration visitClassDeclaration(ClassDeclaration node) => new ClassDeclaration.full(clone2(node.documentationComment), clone3(node.metadata), node.abstractKeyword, node.classKeyword, clone2(node.name), clone2(node.typeParameters), clone2(node.extendsClause), clone2(node.withClause), clone2(node.implementsClause), node.leftBracket, clone3(node.members), node.rightBracket);
16952+
ClassDeclaration visitClassDeclaration(ClassDeclaration node) {
16953+
ClassDeclaration copy = new ClassDeclaration.full(clone2(node.documentationComment), clone3(node.metadata), node.abstractKeyword, node.classKeyword, clone2(node.name), clone2(node.typeParameters), clone2(node.extendsClause), clone2(node.withClause), clone2(node.implementsClause), node.leftBracket, clone3(node.members), node.rightBracket);
16954+
copy.nativeClause = clone2(node.nativeClause);
16955+
return copy;
16956+
}
1695016957
ClassTypeAlias visitClassTypeAlias(ClassTypeAlias node) => new ClassTypeAlias.full(clone2(node.documentationComment), clone3(node.metadata), node.keyword, clone2(node.name), clone2(node.typeParameters), node.equals, node.abstractKeyword, clone2(node.superclass), clone2(node.withClause), clone2(node.implementsClause), node.semicolon);
1695116958
Comment visitComment(Comment node) {
1695216959
if (node.isDocumentation) {

pkg/analyzer_experimental/lib/src/generated/element.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5719,7 +5719,7 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
57195719
}
57205720
String get displayName {
57215721
String name = this.name;
5722-
if (name == null) {
5722+
if (name == null || name.length == 0) {
57235723
List<Type2> normalParameterTypes = this.normalParameterTypes;
57245724
List<Type2> optionalParameterTypes = this.optionalParameterTypes;
57255725
Map<String, Type2> namedParameterTypes = this.namedParameterTypes;
@@ -6563,11 +6563,15 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
65636563
if (argumentTypes.length != parameterTypes.length) {
65646564
throw new IllegalArgumentException("argumentTypes.length (${argumentTypes.length}) != parameterTypes.length (${parameterTypes.length})");
65656565
}
6566-
if (argumentTypes.length == 0) {
6566+
if (argumentTypes.length == 0 || _typeArguments.length == 0) {
6567+
return this;
6568+
}
6569+
List<Type2> newTypeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, parameterTypes);
6570+
if (JavaArrays.equals(newTypeArguments, _typeArguments)) {
65676571
return this;
65686572
}
65696573
InterfaceTypeImpl newType = new InterfaceTypeImpl.con1(element);
6570-
newType.typeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, parameterTypes);
6574+
newType.typeArguments = newTypeArguments;
65716575
return newType;
65726576
}
65736577
void appendTo(JavaStringBuilder builder) {

pkg/analyzer_experimental/lib/src/generated/engine.dart

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,11 @@ class DartEntryImpl extends SourceEntryImpl implements DartEntry {
11091109
state = state._nextState;
11101110
}
11111111
;
1112-
return CacheState.INVALID;
1112+
if (identical(descriptor, DartEntry.RESOLUTION_ERRORS) || identical(descriptor, DartEntry.RESOLVED_UNIT) || identical(descriptor, DartEntry.HINTS)) {
1113+
return CacheState.INVALID;
1114+
} else {
1115+
throw new IllegalArgumentException("Invalid descriptor: ${descriptor}");
1116+
}
11131117
}
11141118
Object getValue(DataDescriptor descriptor) {
11151119
if (identical(descriptor, DartEntry.ELEMENT)) {
@@ -1311,9 +1315,11 @@ class DartEntryImpl extends SourceEntryImpl implements DartEntry {
13111315
}
13121316
if (_parsedUnitState != CacheState.VALID) {
13131317
_parsedUnit = unit;
1318+
_parsedUnitState = CacheState.VALID;
13141319
}
13151320
if (_parseErrorsState != CacheState.VALID) {
13161321
_parseErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
1322+
_parseErrorsState = CacheState.VALID;
13171323
}
13181324
}
13191325
void setState(DataDescriptor<Object> descriptor, CacheState state) {
@@ -4964,10 +4970,12 @@ class RecordingErrorListener implements AnalysisErrorListener {
49644970
*/
49654971
class ResolutionEraser extends GeneralizingASTVisitor<Object> {
49664972
Object visitAssignmentExpression(AssignmentExpression node) {
4973+
node.staticElement = null;
49674974
node.element = null;
49684975
return super.visitAssignmentExpression(node);
49694976
}
49704977
Object visitBinaryExpression(BinaryExpression node) {
4978+
node.staticElement = null;
49714979
node.element = null;
49724980
return super.visitBinaryExpression(node);
49734981
}
@@ -4980,6 +4988,7 @@ class ResolutionEraser extends GeneralizingASTVisitor<Object> {
49804988
return super.visitConstructorDeclaration(node);
49814989
}
49824990
Object visitConstructorName(ConstructorName node) {
4991+
node.staticElement = null;
49834992
node.element = null;
49844993
return super.visitConstructorName(node);
49854994
}
@@ -4997,34 +5006,42 @@ class ResolutionEraser extends GeneralizingASTVisitor<Object> {
49975006
return super.visitFunctionExpression(node);
49985007
}
49995008
Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
5009+
node.staticElement = null;
50005010
node.element = null;
50015011
return super.visitFunctionExpressionInvocation(node);
50025012
}
50035013
Object visitIndexExpression(IndexExpression node) {
5014+
node.staticElement = null;
50045015
node.element = null;
50055016
return super.visitIndexExpression(node);
50065017
}
50075018
Object visitInstanceCreationExpression(InstanceCreationExpression node) {
5019+
node.staticElement = null;
50085020
node.element = null;
50095021
return super.visitInstanceCreationExpression(node);
50105022
}
50115023
Object visitPostfixExpression(PostfixExpression node) {
5024+
node.staticElement = null;
50125025
node.element = null;
50135026
return super.visitPostfixExpression(node);
50145027
}
50155028
Object visitPrefixExpression(PrefixExpression node) {
5029+
node.staticElement = null;
50165030
node.element = null;
50175031
return super.visitPrefixExpression(node);
50185032
}
50195033
Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) {
5034+
node.staticElement = null;
50205035
node.element = null;
50215036
return super.visitRedirectingConstructorInvocation(node);
50225037
}
50235038
Object visitSimpleIdentifier(SimpleIdentifier node) {
5039+
node.staticElement = null;
50245040
node.element = null;
50255041
return super.visitSimpleIdentifier(node);
50265042
}
50275043
Object visitSuperConstructorInvocation(SuperConstructorInvocation node) {
5044+
node.staticElement = null;
50285045
node.element = null;
50295046
return super.visitSuperConstructorInvocation(node);
50305047
}

pkg/analyzer_experimental/lib/src/generated/error.dart

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,18 +2616,6 @@ class StaticWarningCode implements Comparable<StaticWarningCode>, ErrorCode {
26162616
*/
26172617
static final StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = new StaticWarningCode('TYPE_PARAMETER_REFERENCED_BY_STATIC', 62, "Static members cannot reference type parameters");
26182618

2619-
/**
2620-
* 15.1 Static Types: A type <i>T</i> is malformed iff: * <i>T</i> has the form <i>id</i> or the
2621-
* form <i>prefix.id</i>, and in the enclosing lexical scope, the name <i>id</i> (respectively
2622-
* <i>prefix.id</i>) does not denote a type. * <i>T</i> denotes a type variable in the
2623-
* enclosing lexical scope, but occurs in the signature or body of a static member. *
2624-
* <i>T</i> is a parameterized type of the form <i>G&lt;S<sub>1</sub>, .., S<sub>n</sub>&gt;</i>,
2625-
* and <i>G</i> is malformed.
2626-
*
2627-
* Any use of a malformed type gives rise to a static warning.
2628-
*/
2629-
static final StaticWarningCode TYPE_VARIABLE_IN_STATIC_SCOPE = new StaticWarningCode('TYPE_VARIABLE_IN_STATIC_SCOPE', 63, "");
2630-
26312619
/**
26322620
* 12.15.3 Static Invocation: A static method invocation <i>i</i> has the form
26332621
* <i>C.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;
@@ -2636,12 +2624,12 @@ class StaticWarningCode implements Comparable<StaticWarningCode>, ErrorCode {
26362624
*
26372625
* @param undefinedClassName the name of the undefined class
26382626
*/
2639-
static final StaticWarningCode UNDEFINED_CLASS = new StaticWarningCode('UNDEFINED_CLASS', 64, "Undefined class '%s'");
2627+
static final StaticWarningCode UNDEFINED_CLASS = new StaticWarningCode('UNDEFINED_CLASS', 63, "Undefined class '%s'");
26402628

26412629
/**
26422630
* Same as [UNDEFINED_CLASS], but to catch using "boolean" instead of "bool".
26432631
*/
2644-
static final StaticWarningCode UNDEFINED_CLASS_BOOLEAN = new StaticWarningCode('UNDEFINED_CLASS_BOOLEAN', 65, "Undefined class 'boolean'; did you mean 'bool'?");
2632+
static final StaticWarningCode UNDEFINED_CLASS_BOOLEAN = new StaticWarningCode('UNDEFINED_CLASS_BOOLEAN', 64, "Undefined class 'boolean'; did you mean 'bool'?");
26452633

26462634
/**
26472635
* 12.17 Getter Invocation: It is a static warning if there is no class <i>C</i> in the enclosing
@@ -2651,15 +2639,15 @@ class StaticWarningCode implements Comparable<StaticWarningCode>, ErrorCode {
26512639
* @param getterName the name of the getter
26522640
* @param enclosingType the name of the enclosing type where the getter is being looked for
26532641
*/
2654-
static final StaticWarningCode UNDEFINED_GETTER = new StaticWarningCode('UNDEFINED_GETTER', 66, "There is no such getter '%s' in '%s'");
2642+
static final StaticWarningCode UNDEFINED_GETTER = new StaticWarningCode('UNDEFINED_GETTER', 65, "There is no such getter '%s' in '%s'");
26552643

26562644
/**
26572645
* 12.30 Identifier Reference: It is as static warning if an identifier expression of the form
26582646
* <i>id</i> occurs inside a top level or static function (be it function, method, getter, or
26592647
* setter) or variable initializer and there is no declaration <i>d</i> with name <i>id</i> in the
26602648
* lexical scope enclosing the expression.
26612649
*/
2662-
static final StaticWarningCode UNDEFINED_IDENTIFIER = new StaticWarningCode('UNDEFINED_IDENTIFIER', 67, "Undefined name '%s'");
2650+
static final StaticWarningCode UNDEFINED_IDENTIFIER = new StaticWarningCode('UNDEFINED_IDENTIFIER', 66, "Undefined name '%s'");
26632651

26642652
/**
26652653
* 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, <i>1<=i<=l</i>,
@@ -2668,7 +2656,7 @@ class StaticWarningCode implements Comparable<StaticWarningCode>, ErrorCode {
26682656
*
26692657
* @param name the name of the requested named parameter
26702658
*/
2671-
static final StaticWarningCode UNDEFINED_NAMED_PARAMETER = new StaticWarningCode('UNDEFINED_NAMED_PARAMETER', 68, "The named parameter '%s' is not defined");
2659+
static final StaticWarningCode UNDEFINED_NAMED_PARAMETER = new StaticWarningCode('UNDEFINED_NAMED_PARAMETER', 67, "The named parameter '%s' is not defined");
26722660

26732661
/**
26742662
* 12.18 Assignment: It is as static warning if an assignment of the form <i>v = e</i> occurs
@@ -2683,7 +2671,7 @@ class StaticWarningCode implements Comparable<StaticWarningCode>, ErrorCode {
26832671
* @param setterName the name of the getter
26842672
* @param enclosingType the name of the enclosing type where the setter is being looked for
26852673
*/
2686-
static final StaticWarningCode UNDEFINED_SETTER = new StaticWarningCode('UNDEFINED_SETTER', 69, "There is no such setter '%s' in '%s'");
2674+
static final StaticWarningCode UNDEFINED_SETTER = new StaticWarningCode('UNDEFINED_SETTER', 68, "There is no such setter '%s' in '%s'");
26872675

26882676
/**
26892677
* 12.15.3 Static Invocation: It is a static warning if <i>C</i> does not declare a static method
@@ -2692,7 +2680,7 @@ class StaticWarningCode implements Comparable<StaticWarningCode>, ErrorCode {
26922680
* @param methodName the name of the method
26932681
* @param enclosingType the name of the enclosing type where the method is being looked for
26942682
*/
2695-
static final StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = new StaticWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER', 70, "There is no such static method '%s' in '%s'");
2683+
static final StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = new StaticWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER', 69, "There is no such static method '%s' in '%s'");
26962684
static final List<StaticWarningCode> values = [
26972685
AMBIGUOUS_IMPORT,
26982686
ARGUMENT_TYPE_NOT_ASSIGNABLE,
@@ -2757,7 +2745,6 @@ class StaticWarningCode implements Comparable<StaticWarningCode>, ErrorCode {
27572745
SWITCH_EXPRESSION_NOT_ASSIGNABLE,
27582746
TYPE_TEST_NON_TYPE,
27592747
TYPE_PARAMETER_REFERENCED_BY_STATIC,
2760-
TYPE_VARIABLE_IN_STATIC_SCOPE,
27612748
UNDEFINED_CLASS,
27622749
UNDEFINED_CLASS_BOOLEAN,
27632750
UNDEFINED_GETTER,

pkg/analyzer_experimental/lib/src/generated/parser.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ class Parser {
15881588
return parseInitializedIdentifierList(commentAndMetadata, modifiers.staticKeyword, validateModifiersForField(modifiers), returnType);
15891589
}
15901590
}
1591-
if (isOperator(peek())) {
1591+
if (isOperator(_currentToken)) {
15921592
validateModifiersForOperator(modifiers);
15931593
return parseOperator(commentAndMetadata, modifiers.externalKeyword, returnType);
15941594
}
@@ -1605,7 +1605,7 @@ class Parser {
16051605
validateModifiersForOperator(modifiers);
16061606
return parseOperator(commentAndMetadata, modifiers.externalKeyword, null);
16071607
} else if (!matchesIdentifier()) {
1608-
if (isOperator(peek())) {
1608+
if (isOperator(_currentToken)) {
16091609
validateModifiersForOperator(modifiers);
16101610
return parseOperator(commentAndMetadata, modifiers.externalKeyword, null);
16111611
}
@@ -1642,7 +1642,7 @@ class Parser {
16421642
if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
16431643
return parseInitializedIdentifierList(commentAndMetadata, modifiers.staticKeyword, validateModifiersForField(modifiers), type);
16441644
}
1645-
if (isOperator(peek())) {
1645+
if (isOperator(_currentToken)) {
16461646
validateModifiersForOperator(modifiers);
16471647
return parseOperator(commentAndMetadata, modifiers.externalKeyword, type);
16481648
}

pkg/analyzer_experimental/lib/src/generated/resolver.dart

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8012,7 +8012,7 @@ class StaticTypeAnalyzer extends SimpleASTVisitor<Object> {
80128012
* @param library the library being tested
80138013
* @return `true` if the library is 'dart:html'
80148014
*/
8015-
bool isHtmlLibrary(LibraryElement library) => library.name == "dart.dom.html";
8015+
bool isHtmlLibrary(LibraryElement library) => library != null && "dart.dom.html" == library.name;
80168016

80178017
/**
80188018
* Return `true` if the given node is not a type literal.
@@ -11577,15 +11577,6 @@ class ErrorVerifier extends RecursiveASTVisitor<Object> {
1157711577
return true;
1157811578
}
1157911579
}
11580-
List<PropertyAccessorElement> propertyAccessorElts = superclassElement.accessors;
11581-
for (PropertyAccessorElement accessorElt in propertyAccessorElts) {
11582-
if (accessorElt.name == executableElementName && accessorElt.isStatic) {
11583-
_errorReporter.reportError2(StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC, errorNameTarget, [
11584-
executableElementName,
11585-
accessorElt.enclosingElement.displayName]);
11586-
return true;
11587-
}
11588-
}
1158911580
List<MethodElement> methodElements = superclassElement.methods;
1159011581
for (MethodElement methodElement in methodElements) {
1159111582
if (methodElement.name == executableElementName && methodElement.isStatic) {
@@ -13376,18 +13367,26 @@ class ErrorVerifier extends RecursiveASTVisitor<Object> {
1337613367
* Check to make sure that all similarly typed accessors are of the same type (including inherited
1337713368
* accessors).
1337813369
*
13379-
* @param node The accessor currently being visited.
13370+
* @param node the accessor currently being visited
13371+
* @return `true` if and only if an error code is generated on the passed node
1338013372
*/
13381-
void checkForMismatchedAccessorTypes(Declaration accessorDeclaration, String accessorTextName) {
13382-
PropertyAccessorElement counterpartAccessor = null;
13373+
bool checkForMismatchedAccessorTypes(Declaration accessorDeclaration, String accessorTextName) {
1338313374
ExecutableElement accessorElement = accessorDeclaration.element as ExecutableElement;
1338413375
if (accessorElement is! PropertyAccessorElement) {
13385-
return;
13376+
return false;
1338613377
}
13378+
PropertyAccessorElement counterpartAccessor = null;
1338713379
PropertyAccessorElement propertyAccessorElement = accessorElement as PropertyAccessorElement;
13388-
counterpartAccessor = propertyAccessorElement.correspondingSetter;
13380+
if (propertyAccessorElement.isGetter) {
13381+
counterpartAccessor = propertyAccessorElement.correspondingSetter;
13382+
} else {
13383+
counterpartAccessor = propertyAccessorElement.correspondingGetter;
13384+
if (counterpartAccessor != null && identical(counterpartAccessor.enclosingElement, propertyAccessorElement.enclosingElement)) {
13385+
return false;
13386+
}
13387+
}
1338913388
if (counterpartAccessor == null) {
13390-
return;
13389+
return false;
1339113390
}
1339213391
Type2 getterType = null;
1339313392
Type2 setterType = null;
@@ -13404,7 +13403,9 @@ class ErrorVerifier extends RecursiveASTVisitor<Object> {
1340413403
accessorTextName,
1340513404
setterType.displayName,
1340613405
getterType.displayName]);
13406+
return true;
1340713407
}
13408+
return false;
1340813409
}
1340913410

1341013411
/**

pkg/analyzer_experimental/lib/src/generated/sdk.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,8 @@ abstract class DartSdk {
332332
* Return the source representing the library with the given `dart:` URI, or `null` if
333333
* the given URI does not denote a library in this SDK.
334334
*
335-
* @param contentCache the content cache used to access the contents of the mapped source
336335
* @param dartUri the URI of the library to be returned
337336
* @return the source representing the specified library
338337
*/
339-
Source mapDartUri(ContentCache contentCache, String dartUri);
338+
Source mapDartUri(String dartUri);
340339
}

pkg/analyzer_experimental/lib/src/generated/sdk_io.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,12 @@ class DirectoryBasedDartSdk implements DartSdk {
316316
* @return `true` if the Dartium binary is available
317317
*/
318318
bool get isDartiumInstalled => dartiumExecutable != null;
319-
Source mapDartUri(ContentCache contentCache, String dartUri) {
319+
Source mapDartUri(String dartUri) {
320320
SdkLibrary library = getSdkLibrary(dartUri);
321321
if (library == null) {
322322
return null;
323323
}
324-
return new FileBasedSource.con2(contentCache, new JavaFile.relative(libraryDirectory, library.path), UriKind.DART_URI);
324+
return new FileBasedSource.con2(_analysisContext.sourceFactory.contentCache, new JavaFile.relative(libraryDirectory, library.path), UriKind.DART_URI);
325325
}
326326

327327
/**

pkg/analyzer_experimental/lib/src/generated/source.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ class DartUriResolver extends UriResolver {
737737
if (!isDartUri(uri)) {
738738
return null;
739739
}
740-
return _sdk.mapDartUri(contentCache, uri.toString());
740+
return _sdk.mapDartUri(uri.toString());
741741
}
742742
}
743743
/**

0 commit comments

Comments
 (0)