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

Issue 1110583002: Add utilities for creating SourceChanges (Closed)

Created:
5 years, 8 months ago by Brian Wilkerson
Modified:
5 years, 7 months ago
Reviewers:
Paul Berry, scheglov
CC:
reviews_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Add utilities for creating SourceChanges R=scheglov@google.com Committed: https://code.google.com/p/dart/source/detail?r=45461

Patch Set 1 #

Total comments: 8

Patch Set 2 : Add implementation and tests #

Patch Set 3 : Add missed files #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+1587 lines, -10 lines) Patch
A pkg/analysis_server/lib/src/utilities/change_builder_core.dart View 1 1 chunk +249 lines, -0 lines 1 comment Download
A pkg/analysis_server/lib/src/utilities/change_builder_dart.dart View 1 1 chunk +412 lines, -0 lines 2 comments Download
A pkg/analysis_server/lib/utilities/change_builder_core.dart View 1 1 chunk +123 lines, -0 lines 1 comment Download
A pkg/analysis_server/lib/utilities/change_builder_dart.dart View 1 1 chunk +98 lines, -0 lines 0 comments Download
A + pkg/analysis_server/test/src/test_all.dart View 1 2 1 chunk +7 lines, -5 lines 0 comments Download
A pkg/analysis_server/test/src/utilities/change_builder_core_test.dart View 1 2 1 chunk +253 lines, -0 lines 0 comments Download
A pkg/analysis_server/test/src/utilities/change_builder_dart_test.dart View 1 2 1 chunk +438 lines, -0 lines 0 comments Download
A + pkg/analysis_server/test/src/utilities/test_all.dart View 1 2 1 chunk +5 lines, -5 lines 0 comments Download
M pkg/analysis_server/test/test_all.dart View 1 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (2 generated)
Paul Berry
https://codereview.chromium.org/1110583002/diff/1/pkg/analysis_server/lib/utilities/change_builder_core.dart File pkg/analysis_server/lib/utilities/change_builder_core.dart (right): https://codereview.chromium.org/1110583002/diff/1/pkg/analysis_server/lib/utilities/change_builder_core.dart#newcode79 pkg/analysis_server/lib/utilities/change_builder_core.dart:79: * Add the region of text starting at the ...
5 years, 8 months ago (2015-04-27 16:30:10 UTC) #2
Brian Wilkerson
https://codereview.chromium.org/1110583002/diff/1/pkg/analysis_server/lib/utilities/change_builder_core.dart File pkg/analysis_server/lib/utilities/change_builder_core.dart (right): https://codereview.chromium.org/1110583002/diff/1/pkg/analysis_server/lib/utilities/change_builder_core.dart#newcode79 pkg/analysis_server/lib/utilities/change_builder_core.dart:79: * Add the region of text starting at the ...
5 years, 7 months ago (2015-04-28 15:17:00 UTC) #3
Brian Wilkerson
I've made a few changes, added an implementation, and added tests. PTAL.
5 years, 7 months ago (2015-04-29 18:38:54 UTC) #5
scheglov
LGTM
5 years, 7 months ago (2015-04-30 04:35:36 UTC) #6
Brian Wilkerson
Committed patchset #3 (id:40001) manually as 45461 (presubmit successful).
5 years, 7 months ago (2015-04-30 14:57:11 UTC) #7
Paul Berry
5 years, 7 months ago (2015-05-04 16:00:29 UTC) #8
Message was sent while issue was closed.
Sorry for the slow response.  Hopefully these comments aren't too late to be
useful.

https://codereview.chromium.org/1110583002/diff/40001/pkg/analysis_server/lib...
File pkg/analysis_server/lib/src/utilities/change_builder_core.dart (right):

https://codereview.chromium.org/1110583002/diff/40001/pkg/analysis_server/lib...
pkg/analysis_server/lib/src/utilities/change_builder_core.dart:70:
LinkedEditGroup group = _linkedEditGroups[groupName];
This could be written more compactly as:

return _linkedEditGroups.putIfAbsent(groupName, () => new
LinkedEditGroup.empty());

https://codereview.chromium.org/1110583002/diff/40001/pkg/analysis_server/lib...
File pkg/analysis_server/lib/src/utilities/change_builder_dart.dart (right):

https://codereview.chromium.org/1110583002/diff/40001/pkg/analysis_server/lib...
pkg/analysis_server/lib/src/utilities/change_builder_dart.dart:47: static const
String ABSTRACT_MODIFIER = 'abstract ';
Personally, I'm a little dubious about making strings like 'abstract ', 'const
', and so on constants rather than just typing them directly at the site where
they're used.  Normally the benefits of making constants are for terseness or
readability, to allow searching for uses, to provide a convenient place to
document the constant, or to make it easy to change the constant if necessary in
the future.  None of those benefits seem to apply in this situation.

It also seems a little inconsistent that we have constants for 'abstract ' and
'const ' but a lot of other strings are just literal at the usage site like
'class ', ' extends ', ' with ', ' implements ', and so on.

Still, it's largely a matter of personal preference, so your call.

https://codereview.chromium.org/1110583002/diff/40001/pkg/analysis_server/lib...
pkg/analysis_server/lib/src/utilities/change_builder_dart.dart:94: if
(superclass != null) {
Two things:

1. If superclass == null && mixins.isNotEmpty, then an "extends" clause is
required, so we should output "extends Object"

2. If mixins.isEmpty && superclass.isObject, we might want to consider
suppressing the "extends" clause because it's redundant.

https://codereview.chromium.org/1110583002/diff/40001/pkg/analysis_server/lib...
File pkg/analysis_server/lib/utilities/change_builder_core.dart (right):

https://codereview.chromium.org/1110583002/diff/40001/pkg/analysis_server/lib...
pkg/analysis_server/lib/utilities/change_builder_core.dart:82: * The [offset] is
relative to the original source. This is typically used to
This seems incorrect to me.  The implementation of addLinkedPosition uses the
offset to populate a Position in a LinkedEditGroup.  According to the API
specification, a LinkedEditGroup is:

A collection of positions that should be linked (edited simultaneously) for the
purposes of updating code after a source change. For example, if a set of edits
introduced a new variable name, the group would contain all of the positions of
the variable name so that if the client wanted to let the user edit the variable
name after the operation, all occurrences of the name could be edited
simultaneously.

So it seems to me that the offset has to be relative to the state of the
document as it will appear after all the edits have been applied.  Otherwise it
couldn't possibly refer to the positions of variable names that have been
introduced.  Am I misunderstanding?

Powered by Google App Engine
This is Rietveld 408576698