-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for properties to the Wolf analysis prototype.
The AST-to-IR conversion stage now handles reads and writes of properties, whether through a `SimpleIdentifier` (via implicit `this`), a `PrefixedIdentifier`, or a `PropertyAccess` AST node. In order to make this easier to test, support was also added for parenthesized expressions. This required adding the following instruction types: `call` and `shuffle`. To allow for thorough testing, support for these instruction types was added to the interpreter and validator. Change-Id: Ic60452422a877f358b0cad31b3c5664fd0585809 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335701 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Phil Quitslund <pquitslund@google.com>
- Loading branch information
1 parent
412bb9f
commit 4dea626
Showing
12 changed files
with
690 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:analyzer/dart/element/element.dart'; | ||
|
||
/// The target of a `call` instruction in the IR. | ||
sealed class CallDescriptor { | ||
String get name; | ||
} | ||
|
||
/// Call descriptor for an instance (non-static) getter. | ||
class InstanceGetDescriptor extends CallDescriptor { | ||
final PropertyAccessorElement getter; | ||
|
||
InstanceGetDescriptor(this.getter) : assert(getter.isGetter); | ||
|
||
@override | ||
int get hashCode => getter.hashCode; | ||
|
||
@override | ||
String get name => getter.name; | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
other is InstanceGetDescriptor && getter == other.getter; | ||
|
||
@override | ||
String toString() => '${getter.enclosingElement.name}.$name'; | ||
} | ||
|
||
/// Call descriptor for an instance (non-static) setter. | ||
class InstanceSetDescriptor extends CallDescriptor { | ||
final PropertyAccessorElement setter; | ||
|
||
InstanceSetDescriptor(this.setter) : assert(setter.isSetter); | ||
|
||
@override | ||
int get hashCode => setter.hashCode; | ||
|
||
@override | ||
String get name => setter.name; | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
other is InstanceSetDescriptor && setter == other.setter; | ||
|
||
@override | ||
String toString() => '${setter.enclosingElement.name}.$name'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.