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

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: Updated cf. comments 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
« no previous file with comments | « lib/compiler/implementation/typechecker.dart ('k') | lib/compiler/implementation/util/util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/universe/universe.dart
diff --git a/lib/compiler/implementation/universe/universe.dart b/lib/compiler/implementation/universe/universe.dart
index 09cd1467b6697b638fb638f3f63720bea538e840..645d71b77b5173cfe4910803a83634a1f1891eda 100644
--- a/lib/compiler/implementation/universe/universe.dart
+++ b/lib/compiler/implementation/universe/universe.dart
@@ -18,9 +18,32 @@
#source('selector_map.dart');
class Universe {
+ /**
+ * Documentation wanted -- johnniwinther
+ *
+ * Invariant: Key elements are declaration elements.
+ */
Map<Element, CodeBuffer> generatedCode;
+
+ /**
+ * Documentation wanted -- johnniwinther
+ *
+ * Invariant: Key elements are declaration elements.
+ */
Map<Element, CodeBuffer> generatedBailoutCode;
+
+ /**
+ * Documentation wanted -- johnniwinther
+ *
+ * Invariant: Elements are declaration elements.
+ */
final Set<ClassElement> instantiatedClasses;
+
+ /**
+ * Documentation wanted -- johnniwinther
+ *
+ * Invariant: Elements are declaration elements.
+ */
final Set<FunctionElement> staticFunctionsNeedingGetter;
final Map<SourceString, Set<Selector>> invokedNames;
final Map<SourceString, Set<Selector>> invokedGetters;
@@ -43,10 +66,12 @@ class Universe {
rti = new RuntimeTypeInformation();
void addGeneratedCode(WorkItem work, CodeBuffer codeBuffer) {
+ assert(invariant(work.element, work.element.isDeclaration));
generatedCode[work.element] = codeBuffer;
}
void addBailoutCode(WorkItem work, CodeBuffer codeBuffer) {
+ assert(invariant(work.element, work.element.isDeclaration));
generatedBailoutCode[work.element] = codeBuffer;
}
@@ -285,6 +310,7 @@ class Selector implements Hashable {
compileArgument(Node argument),
compileConstant(Element element),
Compiler compiler) {
+ assert(invariant(element, element.isImplementation));
// 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);
@@ -332,6 +358,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,
@@ -339,6 +367,7 @@ class Selector implements Hashable {
compileArgument(Node argument),
compileConstant(Element element),
Compiler compiler) {
+ assert(invariant(element, element.isImplementation));
if (!this.applies(element, compiler)) return false;
FunctionSignature parameters = element.computeSignature(compiler);
« no previous file with comments | « lib/compiler/implementation/typechecker.dart ('k') | lib/compiler/implementation/util/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698