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

Unified Diff: lib/compiler/implementation/ssa/nodes.dart

Issue 10910092: Improvements for checked mode: check when intializing fields, and when assigning to fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/nodes.dart
===================================================================
--- lib/compiler/implementation/ssa/nodes.dart (revision 11954)
+++ lib/compiler/implementation/ssa/nodes.dart (working copy)
@@ -1084,6 +1084,29 @@
}
return false;
}
+
+
+ HInstruction convertType(Compiler compiler,
+ Element sourceElement,
+ int kind) {
+ DartType type = sourceElement.computeType(compiler);
+ if (type === null) return this;
+ if (type.element === compiler.dynamicClass) return this;
+ if (type.element === compiler.objectClass) return this;
+
+ // If the original can't be null, type conversion also can't produce null.
+ bool canBeNull = this.guaranteedType.canBeNull();
+ HType convertedType =
+ new HType.fromBoundedType(type, compiler, canBeNull);
+
+ // No need to convert if we know the instruction has
+ // [convertedType] as a bound.
+ if (this.guaranteedType == convertedType) {
+ return this;
+ }
+
+ return new HTypeConversion(convertedType, this, kind);
+ }
}
class HBoolify extends HInstruction {
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698