Commit Graph

112 Commits

Author SHA1 Message Date
Paul Berry 37f915543f Introduce AstFactory.compilationUnit2 with a required featureSet argument.
Change-Id: I8d709fcb9be1b3a89e617a0c7b35f47813787f06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99966
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-04-29 15:44:39 +00:00
Paul Berry ed984b6985 Sort declarations in pkg/analyzer/test/dart/ast/ast_test.dart
Change-Id: I6710fdfa4ae7a5ca9912d8d73b61a7951a371247
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100402
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-04-24 17:11:56 +00:00
Paul Berry cee1e41fe8 Plumb new FeatureSet class into Scanner.
And change clients of the scanner (within the SDK) to use it.

Long term, it would be better to store the FeatureSet object directly
in the Scanner and remove the existing flags `enableGtGt` and
`enableNonNullable`.  However there are analyzer clients that
currently use these flags.  So for now, we simply plumb in the
FeatureSet as a new way of setting AstBuilder flags.  Once we've
updated clients to use FeatureSet, we'll publish a breaking version of
the analyzer that removes the old flag API.

Change-Id: I9e662f4ed45668d9acd4f56e42d7d8dae6180d48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99975
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-04-23 16:13:43 +00:00
Paul Berry 4a33d33297 Store FeatureSet in CompilationUnit.
Change-Id: I8c132b0ae93ee76adb5cf89f8a725db048b9e935
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100060
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-04-22 17:38:39 +00:00
Brian Wilkerson af0fa108da Add support for required named parameters
Change-Id: Iebfd8da18c6f2158ed39043ab116e2670a7329c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99717
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-04-19 19:25:01 +00:00
Brian Wilkerson 5f0de26d48 Clean up the remaining copyright notices
Change-Id: If099be4f71ba551df0dc3d69815ae6a9f55d1eba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97781
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-03-24 20:11:28 +00:00
Paul Berry 9b5a956a0e Remove AstTestFactory.forStatement2
Change-Id: I8738ffbf1579e070c81c732f818c8ac6582debda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-03-21 12:48:10 +00:00
Paul Berry 7d277c4a32 Introduce methods and classes to replace "2" variants left over from "UI as code" work.
The AST refactor for "UI as code" left behind a few things whose names
ended in "2".  This CL deprecates those things and creates
replacements that don't end in "2", so that we keep the API clean.  In
a future breaking change release of the analyzer we'll remove the
deprecated things.

The following methods and classes are added:
- ForStatement and ForStatementImpl
- ListLiteral.elements
- SetOrMapLiteral.elements
- AstVisitor.visitForStatement
- AstFactory.forStatement
- NodeLintRegistry.addForStatement

The following methods and classes are deprecated:
- ForStatement2 and ForStatement2Impl
- ListLiteral.elements2
- SetOrMapLiteral.elements2
- AstVisitor.visitForStatement2
- AstFactory.forStatement2
- NodeLintRegistry.addForStatement2

In a similar way to how we did the previous stage of AST migration,
the existing visitors have been modified so that the default
implementation of visitForStatement2 redirects to visitForStatement;
this allows clients to change their overrides of visitForStatement2 to
override visitForStatement instead.  Once all clients have been
migrated we will be able to delete the visitForStatement2 method.

Change-Id: Ife5949071fe4cb50791cd4f2f4b99a1bfaad54c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97360
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-03-20 22:58:55 +00:00
Paul Berry b18b626d78 Remove deprecated AST structures related to the "UI as code" feature.
This constitutes a breaking change, so the analyzer major version
number is bumped to 36.  Clients that have stopped using the removed
data structures (and the methods associated with them) should be
unaffected.

Change-Id: Iab68ecf8d10a13013ebb6b1198c54755225d0eb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95704
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-20 03:36:42 +00:00
Paul Berry 9788949db8 Run dartfmt on pkg/analyzer/test/dart/ast/ast_test.dart
Change-Id: Id7388677356bc2af20278eb9e8f5df459fe4df85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97282
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-19 15:25:16 +00:00
Paul Berry 0124541d5f Deprecate AST data structures that will be obseleted by the "UI as code" feature
- ForStatement and ForEachStatement will be replaced by ForStatement2.
- MapLiteral and SetLiteral will be replaced by SetOrMapLiteral.

To ease the transition, the old classes are subtypes of the new
classes, so even though the analyzer still creates instances of the
old classes, clients should be able to start referring to the new
classes in their code.  The analyzer will stop creating instances of
MapLiteral and SetLiteral when the experimental flags for the "UI as
code" feature are turned on, and will stop creating instances of all 4
classes when we bump the major version number (which should happen
sometime in March).

For visitors, we've updated the base classes with the following default methods:
  visitForStatement(node) => visitForStatement2(node);
  visitForEachStatement(node) => visitForStatement2(node);
  visitMapLiteral(node) => visitSetOrMapLiteral(node);
  visitSetLiteral(node) => visitSetOrMapLiteral(node);

So clients should be able to start revising their visitors to override
the new visit methods rather than the old ones, and the visit methods
in the base classes will automatically forward to the new visit
methods.

Change-Id: Ifde3a2aa3c8c49ce4e65dfaabf086db4dabb73f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95665
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-03-06 21:43:50 +00:00
Paul Berry 62df51cb34 Eliminate uses of old AST node types from parts of the analyzer
This CL covers the following subdirectories:
- pkg/analyzer/test/dart/element
- pkg/analyzer/test/generated

Change-Id: If550fef4c625efca7a295d59fbe08f6b5be4407f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95261
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-03-04 19:19:13 +00:00
Konstantin Shcheglov 6f6bed94fd Replace TypeMatcher with isXyzElement.
R=brianwilkerson@google.com

Change-Id: Ibe6d4aa5c5c5e1b692fb527fcd0347a84783b19d
Reviewed-on: https://dart-review.googlesource.com/c/92444
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-08 23:39:48 +00:00
Konstantin Shcheglov d09c1265e9 Issue 35467. Move ast_type_matchers/element_type_matchers into test/util/.
R=brianwilkerson@google.com, paulberry@google.com

Fixes https://github.com/dart-lang/sdk/issues/35467
Change-Id: I2aab476e2e88f5bdbf5e62a2104ff7d271a73209
Reviewed-on: https://dart-review.googlesource.com/c/88780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-01-09 04:46:39 +00:00
Konstantin Shcheglov 162d0d12b0 Remove EngineTestCase.assertInstanceOf and extract ast/element TypeMatcher(s).
R=brianwilkerson@google.com

Change-Id: I9c47b4a7426dccafb8d3ffc1b0652da0106f2184
Reviewed-on: https://dart-review.googlesource.com/c/87302
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-12-14 17:51:27 +00:00
Brian Wilkerson 032bfe0872 Use void rather than Object as a type argument when possible
Change-Id: I275a20e6f58a01adda3be64cf83930cc238beed3
Reviewed-on: https://dart-review.googlesource.com/c/84700
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-19 18:32:31 +00:00
Brian Wilkerson dee5e8a070 Convert more classes to mixins
Change-Id: I85bee426236a510305fc38a49b2f9348af7698df
Reviewed-on: https://dart-review.googlesource.com/c/82181
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-31 13:49:51 +00:00
Brian Wilkerson 469e1e2e64 Remove unnecessary library directives
Change-Id: I7a157080e4d7fd80d64489a13de4e996b5870930
Reviewed-on: https://dart-review.googlesource.com/c/79474
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-13 00:44:04 +00:00
Konstantin Shcheglov 1bceca91b0 Remove the 'name' constructor parameter from CompilationUnitElementImpl()
It costed us about 1.2% of total analysis time.
The whole information about a unit is available in its Source.

R=brianwilkerson@google.com

Change-Id: Iffa253d1eae1a466c10766f66c6c677e19be124a
Reviewed-on: https://dart-review.googlesource.com/77220
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-28 21:53:24 +00:00
Konstantin Shcheglov d659022f08 Build elements for MixinDeclaration(s).
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ica9912b795bbdfeea2dd46130e30bde3bdc4cef3
Reviewed-on: https://dart-review.googlesource.com/72067
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-29 21:05:35 +00:00
Konstantin Shcheglov 4a4132ccab Change code ranges for fields/variables.
We used to set the code range of the whole FieldDeclaration for each
individual VariableDeclaration even when there are multiple of them.

Now the first VariableDeclaration will use code range that starts at
the beginning of the FieldDeclaration, and ends at the end of its
initializer. The subsequent variables (if any) will start of the
start of their names. So, each variable will get unique code range.

R=brianwilkerson@google.com

Change-Id: I0a93bdad2a17454fd5b343b395c72440c86b421d
Reviewed-on: https://dart-review.googlesource.com/70981
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-21 20:57:16 +00:00
Brian Wilkerson 87f753dbd3 Replace some declarations of element with declaredElement
Change-Id: Idd62472b16cccaa98749a510197ec8d0f5053cb1
Reviewed-on: https://dart-review.googlesource.com/67820
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-08-02 16:00:36 +00:00
Kevin Moore cb4a19b5fc misc(pkg/analyzer): update to latest pkg:matcher API
Change-Id: I42a5c41394226f6ddc9c0608c6d688ae683ffdea
Reviewed-on: https://dart-review.googlesource.com/62680
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-06-27 19:29:20 +00:00
Konstantin Shcheglov bdbf872079 Issue 33373. Support for annotations for enum constants.
R=brianwilkerson@google.com

Fixes https://github.com/dart-lang/sdk/issues/33373
Fixes https://github.com/dart-lang/sdk/issues/33375

Change-Id: I917458b38ed7d6c83351f87387d6854e5311ddf2
Reviewed-on: https://dart-review.googlesource.com/59440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-06-08 18:15:00 +00:00
Brian Wilkerson 98671b2659 Make DeclaredVariables immutable
Change-Id: I3d0233cfb4002140af7cf0166cd98466d73d630c
Reviewed-on: https://dart-review.googlesource.com/50580
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-11 01:58:51 +00:00
danrubel b82e5b4704 Replace code completion usage of token.previous with findPrevious
This CL is the first in a multi-part effort to remove the `previous`
field from the Token class. This first step introduces a new findPrevious
utility method that finds the the token before a given token in a token stream,
and then replaces usages of token.previous with calls to this
new findPrevious utility.

Change-Id: I57de4e542adb5950f1bddd951ff555dd98b19b3b
Reviewed-on: https://dart-review.googlesource.com/48461
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-28 02:27:54 +00:00
Brian Wilkerson 1d159e7c23 Rename annotation testing methods in Element
Change-Id: I0f60b9abd3de350e62d89eac0d690a1db40316b7
Reviewed-on: https://dart-review.googlesource.com/45080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-05 17:23:48 +00:00
Brian Wilkerson 5fd560f96b Add getters to replace ParameterKind
Change-Id: I0886c8d032e963857b8054e894ed3343a235b5c2
Reviewed-on: https://dart-review.googlesource.com/44921
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-05 14:22:52 +00:00
Brian Wilkerson b8f870c524 Add support for testing the highlight range of errors
Change-Id: I077ee8318756450271b68c70ed304807a1dfb240
Reviewed-on: https://dart-review.googlesource.com/16640
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-25 20:00:26 +00:00
Konstantin Shcheglov d4dec4e1a4 Create GenericTypeAliasElement for both FunctionTypeAlias and GenericTypeAlias nodes.
Some pain points are:

1. It is a breaking change. I think I will break it even more by removing
   FunctionTypeAliasElement altogether.

2. We lose ability to keep track that this FunctionType is instantiation
   of a typedef. Just like in Kernel.

3. We sometimes have to look up to see if the GenericFunctionTypeElement
   is a function in a named GenericTypeAliasElement.

R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: Ib250cc446a0ed5b8969f16f7cc6293ef4acf01a8
Reviewed-on: https://dart-review.googlesource.com/9421
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-29 00:39:05 +00:00
Konstantin Shcheglov f7eba2359b Create new style GenericFunctionTypeElementImpl for function typed parameters.
ParameterElement.parameters/typeParameters always return empty lists.

This was initially landed as https://dart-review.googlesource.com/c/sdk/+/3401,
but was rolled back because of dartdoc breakage.

R=brianwilkerson@google.com

Bug:
Change-Id: I328355fa4520536dfd0029966ad9f9af2e63a7d2
Reviewed-on: https://dart-review.googlesource.com/5000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-09-11 19:15:11 +00:00
Lasse Reichstein Holst Nielsen 76a3b431bb Revert "Create new style GenericFunctionTypeElementImpl for function typed parameters."
This CL broke the SDK API-doc generation.
See https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Fclient.dart%2Fdart-sdk-linux-be%2F15242%2F%2B%2Frecipes%2Fsteps%2Fgenerate_API_docs%2F0%2Fstdout

Change-Id: I2b4acd766fb65e82a29b73412833e04112ba9dc4
Reviewed-on: https://dart-review.googlesource.com/3460
Reviewed-by: Jonas Termansen <sortie@google.com>
2017-09-06 10:43:11 +00:00
Konstantin Shcheglov a3f8740bbd Create new style GenericFunctionTypeElementImpl for function typed parameters.
ParameterElement.parameters/typeParameters always return empty lists.

R=brianwilkerson@google.com

Bug:
Change-Id: I5200df9e891031437d6e597f30fa54399b7d00e1
Reviewed-on: https://dart-review.googlesource.com/3401
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-06 02:31:11 +00:00
Konstantin Shcheglov 00d5012906 Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt.
...instead of mixing formatting with actual changes in many CLs.

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2975253002 .
2017-07-13 16:28:18 -07:00
Konstantin Shcheglov 4323722416 Stop using ExecutableElement.functions in tests.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2965423002 .
2017-07-07 13:05:38 -07:00
Konstantin Shcheglov 4f7a4f443d Remove ExecutableElement.labels usages in tests.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2974513002 .
2017-07-06 11:44:32 -07:00
Konstantin Shcheglov 7ed5e1c433 Remove ExecutableElement.localVariables altogether.
It is not used in analyzer or analysis_server, and in packages in
internal codebase.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2966313002 .
2017-07-05 16:59:41 -07:00
Konstantin Shcheglov ee177cb51e Remove other usages of ExecutableElement.localVariables.
Use AST to find LocalVariableElement(s), don't test for empty.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2971893002 .
2017-07-05 14:33:09 -07:00
Brian Wilkerson 4fab4a1f52 Clean up type parameters in comments
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2948393002 .
2017-06-23 12:53:11 -07:00
Konstantin Shcheglov 8c391c1f14 Tests for SimpleIdentifier.inGetterContext() updated in other CL.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2844343002 .
2017-04-27 10:54:39 -07:00
Konstantin Shcheglov 2143087734 Build GenericFunctionTypeElementImpl in both ApiElementBuilder and LocalElementBuilder.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2809423003 .
2017-04-12 09:39:31 -07:00
Konstantin Shcheglov 16e9641583 Build elements for FieldFormalParameter(s) even for local functions.
This is invalid code, we report an error, but we cannot leave it as
null, because this causes exceptions down the stream.

R=paulberry@google.com, brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2800443002 .
2017-04-04 12:45:11 -07:00
Paul Berry 67463b0f7d Make some parser test helper methods non-static.
This paves the way for allowing more of analyzer's parser tests to be
run on both Fasta's parser and the analyzer parser.

R=brianwilkerson@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2683543006 .
2017-02-08 08:24:55 -08:00
Brian Wilkerson abeac7ea44 Element model support for covariant
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2644543005 .
2017-01-20 07:59:24 -08:00
Paul Berry 0c31815f1c Transition analyzer and analysis_server to new astFactory.
This is the same as 1d028eed8d (which
was reverted) except that it doesn't remove the old AST factory
constructors (which broke dev_compiler).  The removal of old AST
factory constructors will be done in a follow-up CL so that if it
unexpectedly breaks any other clients we will be able to revert it
without reverting this CL.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2536373008 .
2016-12-01 10:56:21 -08:00
Vijay Menon b8d3758dcd Revert "Transition analyzer and analysis_server to new astFactory; remove old AST factory methods."
This reverts commit 1d028eed8d.

This was breaking DDC.

TBR=paulberry@google.com

Review URL: https://codereview.chromium.org/2542753002 .
2016-11-30 14:57:49 -08:00
Paul Berry 1d028eed8d Transition analyzer and analysis_server to new astFactory; remove old AST factory methods.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2539243002 .
2016-11-30 12:28:51 -08:00
Paul Berry 05a6045674 Rename AstFactory -> AstTestFactory.
This paves the way for introducing a new AstFactory class that will be
part of the analyzer public API.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2524903002 .
2016-11-22 16:09:51 -08:00
Paul Berry 4054d93fc9 Handle default formal parameters in LocalElementBuilder
Fixes #27615.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2437793002 .
2016-10-19 11:17:43 -07:00
Konstantin Shcheglov 412cceb7d0 Add tests showing using LocalElementBuilder separately, for variable or body.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2428773004 .
2016-10-18 14:38:06 -07:00