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

Issue 10696147: Patch methods in classes. (Closed)

Created:
8 years, 5 months ago by Lasse Reichstein Nielsen
Modified:
8 years, 5 months ago
CC:
reviews_dartlang.org, Ivan Posva
Visibility:
Public.

Description

Patch methods in classes. Add math library in corelib/unified. Location subject to change. Made _Random's implementation external and patched it to use JS random. Made "external" marking acually work. Committed: https://code.google.com/p/dart/source/detail?r=9544

Patch Set 1 #

Total comments: 4

Patch Set 2 : Small type/typo fixes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+309 lines, -73 lines) Patch
A + corelib/unified/math/base.dart View 2 chunks +14 lines, -14 lines 0 comments Download
A + corelib/unified/math/math.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A corelib/unified/math/random.dart View 1 chunk +47 lines, -0 lines 0 comments Download
M lib/compiler/implementation/compiler.dart View 1 6 chunks +83 lines, -45 lines 0 comments Download
M lib/compiler/implementation/elements/elements.dart View 1 1 chunk +3 lines, -3 lines 0 comments Download
M lib/compiler/implementation/lib/math.dartp View 1 chunk +87 lines, -3 lines 0 comments Download
M lib/compiler/implementation/library_map.dart View 1 chunk +1 line, -1 line 0 comments Download
M lib/compiler/implementation/patch_parser.dart View 1 4 chunks +52 lines, -1 line 0 comments Download
M lib/compiler/implementation/scanner/class_element_parser.dart View 4 chunks +7 lines, -3 lines 0 comments Download
M lib/compiler/implementation/scanner/listener.dart View 1 2 chunks +6 lines, -2 lines 0 comments Download
M lib/compiler/implementation/scanner/parser.dart View 2 chunks +2 lines, -2 lines 0 comments Download
M tests/compiler/dart2js_extra/math_lib_prefix_test.dart View 1 chunk +4 lines, -0 lines 0 comments Download
M tests/compiler/dart2js_extra/math_lib_test.dart View 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Lasse Reichstein Nielsen
8 years, 5 months ago (2012-07-10 14:12:09 UTC) #1
floitsch
LGTM. https://chromiumcodereview.appspot.com/10696147/diff/1/lib/compiler/implementation/compiler.dart File lib/compiler/implementation/compiler.dart (right): https://chromiumcodereview.appspot.com/10696147/diff/1/lib/compiler/implementation/compiler.dart#newcode582 lib/compiler/implementation/compiler.dart:582: /// WHAT IS WRONG HERE? Why isn't _RANDOM ...
8 years, 5 months ago (2012-07-10 17:53:45 UTC) #2
Lasse Reichstein Nielsen
8 years, 5 months ago (2012-07-11 07:45:22 UTC) #3
https://chromiumcodereview.appspot.com/10696147/diff/1/lib/compiler/implement...
File lib/compiler/implementation/compiler.dart (right):

https://chromiumcodereview.appspot.com/10696147/diff/1/lib/compiler/implement...
lib/compiler/implementation/compiler.dart:582: /// WHAT IS WRONG HERE? Why isn't
_RANDOM in the library?
Absolutely. Just a comment to myself, so I could remember over lunch what I was
working on :)

https://chromiumcodereview.appspot.com/10696147/diff/1/lib/compiler/implement...
lib/compiler/implementation/compiler.dart:673: // i.e., until [parseNode] is
called on [original].
It doesn't. 
We first diet-parse the structure of a library, where we don't even go into the
classes. Then we parse the classes if they are used, but don't parse the
function bodies yet (which is how the primitive patching works - it needs to be
done before the function body is first parsed, otherwise there might be a Node
out there pointing to the wrong body).
With this change, we immediately scan the bodies of patched classes, even if
they are never used.

Powered by Google App Engine
This is Rietveld 408576698