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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/native/js.dart

Issue 694353007: Move dart2js from sdk/lib/_internal/compiler to pkg/compiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
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.
4
5 part of native;
6
7 class SideEffectsVisitor extends js.BaseVisitor {
8 final SideEffects sideEffects;
9 SideEffectsVisitor(this.sideEffects);
10
11 void visit(js.Node node) {
12 node.accept(this);
13 }
14
15 void visitLiteralExpression(js.LiteralExpression node) {
16 sideEffects.setAllSideEffects();
17 sideEffects.setDependsOnSomething();
18 node.visitChildren(this);
19 }
20
21 void visitLiteralStatement(js.LiteralStatement node) {
22 sideEffects.setAllSideEffects();
23 sideEffects.setDependsOnSomething();
24 node.visitChildren(this);
25 }
26
27 void visitAssignment(js.Assignment node) {
28 sideEffects.setChangesStaticProperty();
29 sideEffects.setChangesInstanceProperty();
30 sideEffects.setChangesIndex();
31 node.visitChildren(this);
32 }
33
34 void visitVariableInitialization(js.VariableInitialization node) {
35 node.visitChildren(this);
36 }
37
38 void visitCall(js.Call node) {
39 sideEffects.setAllSideEffects();
40 sideEffects.setDependsOnSomething();
41 node.visitChildren(this);
42 }
43
44 void visitBinary(js.Binary node) {
45 node.visitChildren(this);
46 }
47
48 void visitThrow(js.Throw node) {
49 // TODO(ngeoffray): Incorporate a mayThrow flag in the
50 // [SideEffects] class.
51 sideEffects.setAllSideEffects();
52 }
53
54 void visitNew(js.New node) {
55 sideEffects.setAllSideEffects();
56 sideEffects.setDependsOnSomething();
57 node.visitChildren(this);
58 }
59
60 void visitPrefix(js.Prefix node) {
61 if (node.op == 'delete') {
62 sideEffects.setChangesStaticProperty();
63 sideEffects.setChangesInstanceProperty();
64 sideEffects.setChangesIndex();
65 }
66 node.visitChildren(this);
67 }
68
69 void visitVariableUse(js.VariableUse node) {
70 sideEffects.setDependsOnStaticPropertyStore();
71 }
72
73 void visitPostfix(js.Postfix node) {
74 node.visitChildren(this);
75 }
76
77 void visitAccess(js.PropertyAccess node) {
78 sideEffects.setDependsOnIndexStore();
79 sideEffects.setDependsOnInstancePropertyStore();
80 sideEffects.setDependsOnStaticPropertyStore();
81 node.visitChildren(this);
82 }
83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698