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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 12431009: Add --analyze-signatures-only option to dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 Element operator[](Node node); 8 Element operator[](Node node);
9 Selector getSelector(Send send); 9 Selector getSelector(Send send);
10 Selector getGetterSelectorInComplexSendSet(SendSet node); 10 Selector getGetterSelectorInComplexSendSet(SendSet node);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 356 }
357 357
358 /// This method should only be used by this library (or tests of 358 /// This method should only be used by this library (or tests of
359 /// this library). 359 /// this library).
360 ResolverVisitor visitorFor(Element element) { 360 ResolverVisitor visitorFor(Element element) {
361 var mapping = new TreeElementMapping(element); 361 var mapping = new TreeElementMapping(element);
362 return new ResolverVisitor(compiler, element, mapping); 362 return new ResolverVisitor(compiler, element, mapping);
363 } 363 }
364 364
365 void visitBody(ResolverVisitor visitor, Statement body) { 365 void visitBody(ResolverVisitor visitor, Statement body) {
366 visitor.visit(body); 366 if (!compiler.analyzeSignaturesOnly) {
367 visitor.visit(body);
368 }
367 } 369 }
368 370
369 void resolveConstructorImplementation(FunctionElement constructor, 371 void resolveConstructorImplementation(FunctionElement constructor,
370 FunctionExpression node) { 372 FunctionExpression node) {
371 if (!identical(constructor.defaultImplementation, constructor)) return; 373 if (!identical(constructor.defaultImplementation, constructor)) return;
372 ClassElement intrface = constructor.getEnclosingClass(); 374 ClassElement intrface = constructor.getEnclosingClass();
373 if (!intrface.isInterface()) return; 375 if (!intrface.isInterface()) return;
374 DartType defaultType = intrface.defaultClass; 376 DartType defaultType = intrface.defaultClass;
375 if (defaultType == null) { 377 if (defaultType == null) {
376 error(node, MessageKind.NO_DEFAULT_CLASS, 378 error(node, MessageKind.NO_DEFAULT_CLASS,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 429 }
428 } 430 }
429 431
430 TreeElements resolveField(VariableElement element) { 432 TreeElements resolveField(VariableElement element) {
431 Node tree = element.parseNode(compiler); 433 Node tree = element.parseNode(compiler);
432 if(element.modifiers.isStatic() && element.variables.isTopLevel()) { 434 if(element.modifiers.isStatic() && element.variables.isTopLevel()) {
433 error(element.modifiers.getStatic(), 435 error(element.modifiers.getStatic(),
434 MessageKind.TOP_LEVEL_VARIABLE_DECLARED_STATIC); 436 MessageKind.TOP_LEVEL_VARIABLE_DECLARED_STATIC);
435 } 437 }
436 ResolverVisitor visitor = visitorFor(element); 438 ResolverVisitor visitor = visitorFor(element);
439 // TODO(johnniwinther): Avoid analyzing initializers if
440 // [Compiler.analyzeSignaturesOnly] is set.
437 initializerDo(tree, visitor.visit); 441 initializerDo(tree, visitor.visit);
438 442
439 if (Elements.isStaticOrTopLevelField(element)) { 443 if (Elements.isStaticOrTopLevelField(element)) {
440 if (tree.asSendSet() != null) { 444 if (tree.asSendSet() != null) {
441 // TODO(ngeoffray): We could do better here by using the 445 // TODO(ngeoffray): We could do better here by using the
442 // constant handler to figure out if it's a lazy field or not. 446 // constant handler to figure out if it's a lazy field or not.
443 compiler.backend.registerLazyField(); 447 compiler.backend.registerLazyField();
444 } 448 }
445 } 449 }
446 450
(...skipping 3360 matching lines...) Expand 10 before | Expand all | Expand 10 after
3807 return e; 3811 return e;
3808 } 3812 }
3809 3813
3810 /// Assumed to be called by [resolveRedirectingFactory]. 3814 /// Assumed to be called by [resolveRedirectingFactory].
3811 Element visitReturn(Return node) { 3815 Element visitReturn(Return node) {
3812 Node expression = node.expression; 3816 Node expression = node.expression;
3813 return finishConstructorReference(visit(expression), 3817 return finishConstructorReference(visit(expression),
3814 expression, expression); 3818 expression, expression);
3815 } 3819 }
3816 } 3820 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698