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

Side by Side Diff: pkg/compiler/lib/src/dart_backend/placeholder_collector.dart

Issue 1325843003: Add optional message to assert in Dart2js. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Reintroduce assertHelper for asserts without messages. Created 5 years, 3 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
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 dart_backend; 5 part of dart_backend;
6 6
7 class LocalPlaceholder { 7 class LocalPlaceholder {
8 final String identifier; 8 final String identifier;
9 final Set<Node> nodes; 9 final Set<Node> nodes;
10 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); 10 LocalPlaceholder(this.identifier) : nodes = new Set<Node>();
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 class SendVisitor extends Visitor { 40 class SendVisitor extends Visitor {
41 final TreeElements elements; 41 final TreeElements elements;
42 final PlaceholderCollector collector; 42 final PlaceholderCollector collector;
43 43
44 SendVisitor(this.collector, this.elements); 44 SendVisitor(this.collector, this.elements);
45 45
46 visitSend(Send node) { 46 visitSend(Send node) {
47 Element element = elements[node]; 47 Element element = elements[node];
48 if (elements.isAssert(node)) { 48 if (elements.isTypeLiteral(node)) {
49 return;
50 } else if (elements.isTypeLiteral(node)) {
51 DartType type = elements.getTypeLiteralType(node); 49 DartType type = elements.getTypeLiteralType(node);
52 if (!type.isDynamic) { 50 if (!type.isDynamic) {
53 if (type is TypeVariableType) { 51 if (type is TypeVariableType) {
54 collector.makeTypeVariablePlaceholder(node.selector, type); 52 collector.makeTypeVariablePlaceholder(node.selector, type);
55 } else { 53 } else {
56 collector.makeTypePlaceholder(node.selector, type); 54 collector.makeTypePlaceholder(node.selector, type);
57 } 55 }
58 } 56 }
59 } else if (node.isSuperCall) { 57 } else if (node.isSuperCall) {
60 if (element != null && element.isConstructor) { 58 if (element != null && element.isConstructor) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 130 }
133 } 131 }
134 } 132 }
135 133
136 visitStaticSend(Send node) { 134 visitStaticSend(Send node) {
137 Element element = elements[node]; 135 Element element = elements[node];
138 collector.mirrorRenamer.registerStaticSend( 136 collector.mirrorRenamer.registerStaticSend(
139 collector.currentElement, element, node); 137 collector.currentElement, element, node);
140 138
141 if (Elements.isUnresolved(element) 139 if (Elements.isUnresolved(element)
142 || elements.isAssert(node)
143 || element.isDeferredLoaderGetter) { 140 || element.isDeferredLoaderGetter) {
144 return; 141 return;
145 } 142 }
146 if (element.isConstructor || element.isFactoryConstructor) { 143 if (element.isConstructor || element.isFactoryConstructor) {
147 // Rename named constructor in redirection position: 144 // Rename named constructor in redirection position:
148 // class C { C.named(); C.redirecting() : this.named(); } 145 // class C { C.named(); C.redirecting() : this.named(); }
149 if (node.receiver is Identifier 146 if (node.receiver is Identifier
150 && node.receiver.asIdentifier().isThis()) { 147 && node.receiver.asIdentifier().isThis()) {
151 assert(node.selector is Identifier); 148 assert(node.selector is Identifier);
152 collector.tryMakeConstructorPlaceholder(node, element); 149 collector.tryMakeConstructorPlaceholder(node, element);
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 714
718 visitBlock(Block node) { 715 visitBlock(Block node) {
719 for (Node statement in node.statements.nodes) { 716 for (Node statement in node.statements.nodes) {
720 if (statement is VariableDefinitions) { 717 if (statement is VariableDefinitions) {
721 makeVarDeclarationTypePlaceholder(statement); 718 makeVarDeclarationTypePlaceholder(statement);
722 } 719 }
723 } 720 }
724 node.visitChildren(this); 721 node.visitChildren(this);
725 } 722 }
726 } 723 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698