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

Issue 22819005: Make Null a public class of dart:core. (Closed)

Created:
7 years, 4 months ago by rmacnak
Modified:
7 years, 4 months ago
CC:
reviews_dartlang.org, Michael Lippautz (Google), Lasse Reichstein Nielsen
Visibility:
Public.

Description

Cleanup making Null a public class of dart:core in the VM. Remove special cases for Null in lookup and compile-time type tests. BUG=http://dartbug.com/12364 R=asiva@google.com, regis@google.com Committed: https://code.google.com/p/dart/source/detail?r=26205

Patch Set 1 : #

Patch Set 2 : vm only, rebase #

Total comments: 1

Patch Set 3 : type cast, extends/implements prohibition #

Total comments: 2

Patch Set 4 : IsNullType() without creating a handle #

Patch Set 5 : rebase on dart2js's putback #

Total comments: 6

Patch Set 6 : #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+73 lines, -42 lines) Patch
M runtime/lib/corelib_sources.gypi View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A runtime/lib/null_patch.dart View 1 2 3 4 1 chunk +21 lines, -0 lines 3 comments Download
M runtime/lib/object_patch.dart View 1 2 3 1 chunk +0 lines, -3 lines 0 comments Download
M runtime/vm/class_finalizer.cc View 1 2 3 4 3 chunks +3 lines, -3 lines 0 comments Download
M runtime/vm/code_generator.cc View 3 chunks +2 lines, -12 lines 1 comment Download
M runtime/vm/object.cc View 1 2 3 4 5 4 chunks +13 lines, -16 lines 0 comments Download
M runtime/vm/resolver.cc View 1 chunk +1 line, -8 lines 0 comments Download
M tests/language/null_is_test.dart View 1 2 3 4 1 chunk +31 lines, -0 lines 1 comment Download
M tests/lib/mirrors/null_test.dart View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
rmacnak
Complication: I cannot implement this in the VM without adding Null to the version of ...
7 years, 4 months ago (2013-08-13 20:21:12 UTC) #1
rmacnak
On 2013/08/13 20:21:12, Ryan Macnak wrote: > Complication: I cannot implement this in the VM ...
7 years, 4 months ago (2013-08-13 20:29:15 UTC) #2
ahe
Please coordinate with lrn, see: https://codereview.chromium.org/23012003/ In particular, see my suggestions for testing in the ...
7 years, 4 months ago (2013-08-13 20:41:58 UTC) #3
rmacnak
Amended to a VM-only implementation (doesn't touch sdk/lib).
7 years, 4 months ago (2013-08-13 21:18:13 UTC) #4
Ivan Posva
https://chromiumcodereview.appspot.com/22819005/diff/27001/tests/language/null_is_test.dart File tests/language/null_is_test.dart (right): https://chromiumcodereview.appspot.com/22819005/diff/27001/tests/language/null_is_test.dart#newcode17 tests/language/null_is_test.dart:17: test(null); How about testing that Expect.isFalse(1 is Null); Expect.isFalse("1" ...
7 years, 4 months ago (2013-08-13 21:26:43 UTC) #5
rmacnak
Fix type cast for Null. Prohibit extending or implementing Null. Now passes tests for the ...
7 years, 4 months ago (2013-08-13 22:11:20 UTC) #6
siva
lgtm https://chromiumcodereview.appspot.com/22819005/diff/32001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://chromiumcodereview.appspot.com/22819005/diff/32001/runtime/vm/object.cc#newcode10468 runtime/vm/object.cc:10468: (type_class() == Type::Handle(Type::NullType()).type_class()); why not return HasResolvedTypeClass() && ...
7 years, 4 months ago (2013-08-14 18:53:31 UTC) #7
rmacnak
https://chromiumcodereview.appspot.com/22819005/diff/32001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://chromiumcodereview.appspot.com/22819005/diff/32001/runtime/vm/object.cc#newcode10468 runtime/vm/object.cc:10468: (type_class() == Type::Handle(Type::NullType()).type_class()); On 2013/08/14 18:53:31, siva wrote: > ...
7 years, 4 months ago (2013-08-14 22:31:34 UTC) #8
regis
LGTM https://codereview.chromium.org/22819005/diff/54001/runtime/vm/flow_graph_builder.cc File runtime/vm/flow_graph_builder.cc (left): https://codereview.chromium.org/22819005/diff/54001/runtime/vm/flow_graph_builder.cc#oldcode1226 runtime/vm/flow_graph_builder.cc:1226: Any particular reason to remove these 2 blank ...
7 years, 4 months ago (2013-08-15 17:27:26 UTC) #9
rmacnak
https://chromiumcodereview.appspot.com/22819005/diff/54001/runtime/vm/flow_graph_builder.cc File runtime/vm/flow_graph_builder.cc (left): https://chromiumcodereview.appspot.com/22819005/diff/54001/runtime/vm/flow_graph_builder.cc#oldcode1226 runtime/vm/flow_graph_builder.cc:1226: On 2013/08/15 17:27:26, regis wrote: > Any particular reason ...
7 years, 4 months ago (2013-08-15 17:56:03 UTC) #10
rmacnak
Committed patchset #6 manually as r26205 (presubmit successful).
7 years, 4 months ago (2013-08-15 18:34:32 UTC) #11
Lasse Reichstein Nielsen
7 years, 4 months ago (2013-08-16 08:04:13 UTC) #12
Message was sent while issue was closed.
Drive-by-and-too-late comments.

https://chromiumcodereview.appspot.com/22819005/diff/57001/runtime/lib/null_p...
File runtime/lib/null_patch.dart (right):

https://chromiumcodereview.appspot.com/22819005/diff/57001/runtime/lib/null_p...
runtime/lib/null_patch.dart:14: int get hashCode {
Add /* patch */ in front?

https://chromiumcodereview.appspot.com/22819005/diff/57001/runtime/lib/null_p...
runtime/lib/null_patch.dart:15: return 2011;  // The year Dart was announced and
a prime.
I'd prefer either zero or some real random smi.
"Arbitrary" hash codes like this tend to cluster in the low end of the range.

I can see this was just retained from earlier, but do consider updating it. We
could add it to the Null class directly, if dart2js sees no problem with it.

https://chromiumcodereview.appspot.com/22819005/diff/57001/runtime/lib/null_p...
runtime/lib/null_patch.dart:19: return 'null';
Both the factory constructor and the toString methods are already in the Null
class. No need to override them.

https://chromiumcodereview.appspot.com/22819005/diff/57001/runtime/vm/code_ge...
File runtime/vm/code_generator.cc (right):

https://chromiumcodereview.appspot.com/22819005/diff/57001/runtime/vm/code_ge...
runtime/vm/code_generator.cc:1214: const Class& receiver_class =
Class::Handle(receiver.clazz());
I like how this change makes code *simpler*! :)

https://chromiumcodereview.appspot.com/22819005/diff/57001/tests/language/nul...
File tests/language/null_is_test.dart (right):

https://chromiumcodereview.appspot.com/22819005/diff/57001/tests/language/nul...
tests/language/null_is_test.dart:33: // Test where the argument is not a
compile-time constant.
If this function gets inlined, the n will be a compile-time constant.
Consider doing something to confuse the value beyond the capability of static
analysis.

Powered by Google App Engine
This is Rietveld 408576698