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

Side by Side Diff: dart/pkg/compiler/lib/src/elements/modelx.dart

Issue 845183004: Use synthetic elements to recover from errors in signatures.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r42768. Created 5 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library elements.modelx; 5 library elements.modelx;
6 6
7 import 'elements.dart'; 7 import 'elements.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../helpers/helpers.dart'; // Included for debug helpers. 9 import '../helpers/helpers.dart'; // Included for debug helpers.
10 import '../tree/tree.dart'; 10 import '../tree/tree.dart';
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 // TODO(ahe): Should return the definingElement of the error site? 1371 // TODO(ahe): Should return the definingElement of the error site?
1372 AstElement get definingElement => this; 1372 AstElement get definingElement => this;
1373 1373
1374 void reuseElement() { 1374 void reuseElement() {
1375 throw new UnsupportedError("reuseElement"); 1375 throw new UnsupportedError("reuseElement");
1376 } 1376 }
1377 1377
1378 FieldElementX copyWithEnclosing(Element enclosingElement) { 1378 FieldElementX copyWithEnclosing(Element enclosingElement) {
1379 throw new UnsupportedError("copyWithEnclosing"); 1379 throw new UnsupportedError("copyWithEnclosing");
1380 } 1380 }
1381
1382 DartType computeType(Compiler compiler) => type;
1381 } 1383 }
1382 1384
1383 /// [Element] for a parameter-like element. 1385 /// [Element] for a parameter-like element.
1384 class FormalElementX extends ElementX 1386 class FormalElementX extends ElementX
1385 with AstElementMixin 1387 with AstElementMixin
1386 implements FormalElement { 1388 implements FormalElement {
1387 final VariableDefinitions definitions; 1389 final VariableDefinitions definitions;
1388 final Identifier identifier; 1390 final Identifier identifier;
1389 DartType typeCache; 1391 DartType typeCache;
1390 1392
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 Identifier identifier, 1477 Identifier identifier,
1476 Expression initializer) 1478 Expression initializer)
1477 : super(ElementKind.PARAMETER, functionDeclaration, 1479 : super(ElementKind.PARAMETER, functionDeclaration,
1478 definitions, identifier, initializer); 1480 definitions, identifier, initializer);
1479 } 1481 }
1480 1482
1481 /// Parameters in constructors that directly initialize fields. For example: 1483 /// Parameters in constructors that directly initialize fields. For example:
1482 /// `A(this.field)`. 1484 /// `A(this.field)`.
1483 class InitializingFormalElementX extends ParameterElementX 1485 class InitializingFormalElementX extends ParameterElementX
1484 implements InitializingFormalElement { 1486 implements InitializingFormalElement {
1485 FieldElement fieldElement; 1487 final FieldElement fieldElement;
1486 1488
1487 InitializingFormalElementX(ConstructorElement constructorDeclaration, 1489 InitializingFormalElementX(ConstructorElement constructorDeclaration,
1488 VariableDefinitions variables, 1490 VariableDefinitions variables,
1489 Identifier identifier, 1491 Identifier identifier,
1490 Expression initializer, 1492 Expression initializer,
1491 this.fieldElement) 1493 this.fieldElement)
1492 : super(ElementKind.INITIALIZING_FORMAL, constructorDeclaration, 1494 : super(ElementKind.INITIALIZING_FORMAL, constructorDeclaration,
1493 variables, identifier, initializer); 1495 variables, identifier, initializer);
1494 1496
1495 accept(ElementVisitor visitor) => visitor.visitFieldParameterElement(this); 1497 accept(ElementVisitor visitor) => visitor.visitFieldParameterElement(this);
1496 1498
1497 MemberElement get memberContext => enclosingElement; 1499 MemberElement get memberContext => enclosingElement;
1498 1500
1499 bool get isLocal => false; 1501 bool get isLocal => false;
1500 } 1502 }
1501 1503
1504 class ErroneousInitializingFormalElementX extends ParameterElementX
1505 implements InitializingFormalElementX {
1506 final ErroneousFieldElementX fieldElement;
1507
1508 ErroneousInitializingFormalElementX(
1509 Identifier identifier,
1510 Element enclosingElement)
1511 : this.fieldElement =
1512 new ErroneousFieldElementX(identifier, enclosingElement),
1513 super(
1514 ElementKind.INITIALIZING_FORMAL,
1515 enclosingElement, null, identifier, null);
1516
1517 VariableDefinitions get definitions => fieldElement.node;
1518
1519 MemberElement get memberContext => enclosingElement;
1520
1521 bool get isLocal => false;
1522
1523 bool get isErroneous => true;
1524
1525 DynamicType get type => const DynamicType();
1526 }
1502 1527
1503 class AbstractFieldElementX extends ElementX implements AbstractFieldElement { 1528 class AbstractFieldElementX extends ElementX implements AbstractFieldElement {
1504 FunctionElementX getter; 1529 FunctionElementX getter;
1505 FunctionElementX setter; 1530 FunctionElementX setter;
1506 1531
1507 AbstractFieldElementX(String name, Element enclosing) 1532 AbstractFieldElementX(String name, Element enclosing)
1508 : super(name, ElementKind.ABSTRACT_FIELD, enclosing); 1533 : super(name, ElementKind.ABSTRACT_FIELD, enclosing);
1509 1534
1510 DartType computeType(Compiler compiler) { 1535 DartType computeType(Compiler compiler) {
1511 throw "internal error: AbstractFieldElement has no type"; 1536 throw "internal error: AbstractFieldElement has no type";
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
2938 AstElement get definingElement; 2963 AstElement get definingElement;
2939 2964
2940 bool get hasResolvedAst => definingElement.hasTreeElements; 2965 bool get hasResolvedAst => definingElement.hasTreeElements;
2941 2966
2942 ResolvedAst get resolvedAst { 2967 ResolvedAst get resolvedAst {
2943 return new ResolvedAst(declaration, 2968 return new ResolvedAst(declaration,
2944 definingElement.node, definingElement.treeElements); 2969 definingElement.node, definingElement.treeElements);
2945 } 2970 }
2946 2971
2947 } 2972 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698