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

Unified Diff: lib/compiler/implementation/universe/universe.dart

Issue 10917285: Stub implementation of patch invariants for the patch refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Leftovers from rebase. Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/universe/universe.dart
diff --git a/lib/compiler/implementation/universe/universe.dart b/lib/compiler/implementation/universe/universe.dart
index e57d68c0972654edb7fdb6c9cc73178b2aecacc4..d9a86a6e08e074ed5453fd680eec60b7057e113d 100644
--- a/lib/compiler/implementation/universe/universe.dart
+++ b/lib/compiler/implementation/universe/universe.dart
@@ -18,9 +18,13 @@
#source('selector_map.dart');
class Universe {
+ /// Invariant: Key elements are declaration elements.
Map<Element, CodeBuffer> generatedCode;
+ /// Invariant: Key elements are declaration elements.
Map<Element, CodeBuffer> generatedBailoutCode;
+ /// Invariant: Elements are declaration elements.
final Set<ClassElement> instantiatedClasses;
+ /// Invariant: Elements are declaration elements.
final Set<FunctionElement> staticFunctionsNeedingGetter;
final Map<SourceString, Set<Selector>> invokedNames;
final Map<SourceString, Set<Selector>> invokedGetters;
@@ -29,6 +33,7 @@ class Universe {
final Map<SourceString, Set<Selector>> fieldSetters;
final Set<DartType> isChecks;
// TODO(karlklose): move this data to RuntimeTypeInformation.
+ // Invariant: Elements are declarations.
Set<Element> checkedClasses;
final RuntimeTypeInformation rti;
@@ -52,10 +57,12 @@ class Universe {
}
void addGeneratedCode(WorkItem work, CodeBuffer codeBuffer) {
+ assert(work.element.isDeclaration);
generatedCode[work.element] = codeBuffer;
}
void addBailoutCode(WorkItem work, CodeBuffer codeBuffer) {
+ assert(work.element.isDeclaration);
generatedBailoutCode[work.element] = codeBuffer;
}
@@ -293,6 +300,7 @@ class Selector implements Hashable {
compileArgument(Node argument),
compileConstant(Element element),
Compiler compiler) {
+ assert(element.isImplementation);
ngeoffray 2012/09/17 12:46:24 No sure you need this restriction.
Johnni Winther 2012/09/20 08:12:23 The only call-site enforces the invariant so I'll
// If there are named arguments, provide them in the order
// expected by the called function, which is the source order.
FunctionSignature parameters = element.computeSignature(compiler);
@@ -340,6 +348,8 @@ class Selector implements Hashable {
/**
* Returns [:true:] if the selector and the [element] match; [:false:]
* otherwise.
+ *
+ * Invariant: [element] must be the implementation element.
*/
bool addArgumentsToList(Link<Node> arguments,
List list,
@@ -347,6 +357,7 @@ class Selector implements Hashable {
compileArgument(Node argument),
compileConstant(Element element),
Compiler compiler) {
+ assert(element.isImplementation);
ngeoffray 2012/09/17 12:46:24 ditto
Johnni Winther 2012/09/20 08:12:23 The call-sites enforces the invariant so I'll keep
if (!this.applies(element, compiler)) return false;
FunctionSignature parameters = element.computeSignature(compiler);

Powered by Google App Engine
This is Rietveld 408576698