| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // TODO(johnniwinther): Temporarily copied from analyzer2dart. Merge when | 5 // TODO(johnniwinther): Temporarily copied from analyzer2dart. Merge when |
| 6 // we shared code with the analyzer and this semantic visitor is complete. | 6 // we shared code with the analyzer and this semantic visitor is complete. |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Code for classifying the semantics of identifiers appearing in a Dart file. | 9 * Code for classifying the semantics of identifiers appearing in a Dart file. |
| 10 */ | 10 */ |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 /// class. | 381 /// class. |
| 382 /// | 382 /// |
| 383 /// For instance | 383 /// For instance |
| 384 /// abstract class C { | 384 /// abstract class C { |
| 385 /// C(); | 385 /// C(); |
| 386 /// } | 386 /// } |
| 387 /// m() => new C(); | 387 /// m() => new C(); |
| 388 /// | 388 /// |
| 389 ABSTRACT, | 389 ABSTRACT, |
| 390 | 390 |
| 391 /// An invocation of an unresolved constructor or an unresolved type. | 391 /// An invocation of a constructor on an unresolved type. |
| 392 /// |
| 393 /// For instance |
| 394 /// m() => new Unresolved(); |
| 395 /// |
| 396 UNRESOLVED_TYPE, |
| 397 |
| 398 /// An invocation of an unresolved constructor. |
| 392 /// | 399 /// |
| 393 /// For instance | 400 /// For instance |
| 394 /// class C { | 401 /// class C { |
| 395 /// C(); | 402 /// C(); |
| 396 /// } | 403 /// } |
| 397 /// m1() => new C.unresolved(); | 404 /// m() => new C.unresolved(); |
| 398 /// m2() => new Unresolved(); | |
| 399 /// | 405 /// |
| 400 // TODO(johnniwinther): Differentiate between error types. | 406 UNRESOLVED_CONSTRUCTOR, |
| 401 ERRONEOUS, | 407 |
| 408 /// An const invocation of an non-constant constructor. |
| 409 /// |
| 410 /// For instance |
| 411 /// class C { |
| 412 /// C(); |
| 413 /// } |
| 414 /// m() => const C(); |
| 415 /// |
| 416 NON_CONSTANT_CONSTRUCTOR, |
| 402 | 417 |
| 403 /// An invocation of an ill-defined redirecting factory constructor. | 418 /// An invocation of an ill-defined redirecting factory constructor. |
| 404 /// | 419 /// |
| 405 /// For instance | 420 /// For instance |
| 406 /// class C { | 421 /// class C { |
| 407 /// factory C() = Unresolved; | 422 /// factory C() = Unresolved; |
| 408 /// } | 423 /// } |
| 409 /// m() => new C(); | 424 /// m() => new C(); |
| 410 /// | 425 /// |
| 411 ERRONEOUS_REDIRECTING_FACTORY, | 426 ERRONEOUS_REDIRECTING_FACTORY, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 424 | 439 |
| 425 ConstructorAccessSemantics(this.kind, this.element, this.type); | 440 ConstructorAccessSemantics(this.kind, this.element, this.type); |
| 426 | 441 |
| 427 /// The effect target of the access. Used to defined redirecting factory | 442 /// The effect target of the access. Used to defined redirecting factory |
| 428 /// constructor invocations. | 443 /// constructor invocations. |
| 429 ConstructorAccessSemantics get effectiveTargetSemantics => this; | 444 ConstructorAccessSemantics get effectiveTargetSemantics => this; |
| 430 | 445 |
| 431 /// `true` if this invocation is erroneous. | 446 /// `true` if this invocation is erroneous. |
| 432 bool get isErroneous { | 447 bool get isErroneous { |
| 433 return kind == ConstructorAccessKind.ABSTRACT || | 448 return kind == ConstructorAccessKind.ABSTRACT || |
| 434 kind == ConstructorAccessKind.ERRONEOUS || | 449 kind == ConstructorAccessKind.UNRESOLVED_TYPE || |
| 450 kind == ConstructorAccessKind.UNRESOLVED_CONSTRUCTOR || |
| 451 kind == ConstructorAccessKind.NON_CONSTANT_CONSTRUCTOR || |
| 435 kind == ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY; | 452 kind == ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY; |
| 436 } | 453 } |
| 437 } | 454 } |
| 438 | 455 |
| 439 /// Data structure used to classify the semantics of a redirecting factory | 456 /// Data structure used to classify the semantics of a redirecting factory |
| 440 /// constructor invocation. | 457 /// constructor invocation. |
| 441 class RedirectingFactoryConstructorAccessSemantics | 458 class RedirectingFactoryConstructorAccessSemantics |
| 442 extends ConstructorAccessSemantics { | 459 extends ConstructorAccessSemantics { |
| 443 final ConstructorAccessSemantics effectiveTargetSemantics; | 460 final ConstructorAccessSemantics effectiveTargetSemantics; |
| 444 | 461 |
| 445 RedirectingFactoryConstructorAccessSemantics( | 462 RedirectingFactoryConstructorAccessSemantics( |
| 446 ConstructorAccessKind kind, | 463 ConstructorAccessKind kind, |
| 447 Element element, | 464 Element element, |
| 448 DartType type, | 465 DartType type, |
| 449 this.effectiveTargetSemantics) | 466 this.effectiveTargetSemantics) |
| 450 : super(kind, element, type); | 467 : super(kind, element, type); |
| 451 } | 468 } |
| 452 | 469 |
| 453 | 470 |
| OLD | NEW |