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

Side by Side Diff: pkg/compiler/lib/src/resolution/send_resolver.dart

Issue 1079533002: Handle SendSet and NewExpression through NewResolvedVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix problems with prefix/postfix and erroneous const invocations. Created 5 years, 8 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dart2js.semantics_visitor; 5 part of dart2js.semantics_visitor;
6 6
7 enum SendStructureKind { 7 enum SendStructureKind {
8 GET, 8 GET,
9 SET, 9 SET,
10 INVOKE, 10 INVOKE,
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 return new ConstructorAccessSemantics( 448 return new ConstructorAccessSemantics(
449 ConstructorAccessKind.ABSTRACT, constructor, type); 449 ConstructorAccessKind.ABSTRACT, constructor, type);
450 } else { 450 } else {
451 return new ConstructorAccessSemantics( 451 return new ConstructorAccessSemantics(
452 ConstructorAccessKind.GENERATIVE, constructor, type); 452 ConstructorAccessKind.GENERATIVE, constructor, type);
453 } 453 }
454 } 454 }
455 455
456 NewStructure computeNewStructure(NewExpression node) { 456 NewStructure computeNewStructure(NewExpression node) {
457 if (node.isConst) { 457 if (node.isConst) {
458 return new ConstInvokeStructure(elements.getConstant(node)); 458 ConstantExpression constant = elements.getConstant(node);
459 if (constant is ConstructedConstantExpression) {
460 return new ConstInvokeStructure(constant);
461 }
459 } 462 }
463
460 Element element = elements[node.send]; 464 Element element = elements[node.send];
461 Selector selector = elements.getSelector(node.send); 465 Selector selector = elements.getSelector(node.send);
462 DartType type = elements.getType(node); 466 DartType type = elements.getType(node);
463 467
464 ConstructorAccessSemantics constructorAccessSemantics = 468 ConstructorAccessSemantics constructorAccessSemantics;
465 computeConstructorAccessSemantics(element, type); 469 if (node.isConst) {
470 // This is a non-constant constant constructor invocation, like
471 // `const Const(method())`.
472 constructorAccessSemantics = new ConstructorAccessSemantics(
473 ConstructorAccessKind.ERRONEOUS, element, type);
474 } else {
475 constructorAccessSemantics =
476 computeConstructorAccessSemantics(element, type);
477 }
466 return new NewInvokeStructure(constructorAccessSemantics, selector); 478 return new NewInvokeStructure(constructorAccessSemantics, selector);
467 } 479 }
468 } 480 }
469 481
470 abstract class DeclStructure<R, A> { 482 abstract class DeclStructure<R, A> {
471 final FunctionElement element; 483 final FunctionElement element;
472 484
473 DeclStructure(this.element); 485 DeclStructure(this.element);
474 486
475 /// Calls the matching visit method on [visitor] with [node] and [arg]. 487 /// Calls the matching visit method on [visitor] with [node] and [arg].
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 return internalError(node, "Unexpected variable $element."); 778 return internalError(node, "Unexpected variable $element.");
767 } 779 }
768 if (element.isConst) { 780 if (element.isConst) {
769 ConstantExpression constant = elements.getConstant(element.initializer); 781 ConstantExpression constant = elements.getConstant(element.initializer);
770 return new ConstantVariableStructure(kind, node, element, constant); 782 return new ConstantVariableStructure(kind, node, element, constant);
771 } else { 783 } else {
772 return new NonConstantVariableStructure(kind, node, element); 784 return new NonConstantVariableStructure(kind, node, element);
773 } 785 }
774 } 786 }
775 } 787 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart ('k') | pkg/compiler/lib/src/resolution/send_structure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698