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

Side by Side Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 1932183003: Handle deserialized compilation of closures (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library elements.modelx; 5 library elements.modelx;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/resolution.dart' show Resolution, ParsingContext; 8 import '../common/resolution.dart' show Resolution, ParsingContext;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../constants/constant_constructors.dart'; 10 import '../constants/constant_constructors.dart';
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 while (!element.isCompilationUnit) { 144 while (!element.isCompilationUnit) {
145 element = element.enclosingElement; 145 element = element.enclosingElement;
146 } 146 }
147 return element; 147 return element;
148 } 148 }
149 149
150 LibraryElement get library => enclosingElement.library; 150 LibraryElement get library => enclosingElement.library;
151 151
152 Name get memberName => new Name(name, library); 152 Name get memberName => new Name(name, library);
153 153
154 LibraryElementX get implementationLibrary { 154 LibraryElement get implementationLibrary {
155 Element element = this; 155 Element element = this;
156 while (!identical(element.kind, ElementKind.LIBRARY)) { 156 while (!identical(element.kind, ElementKind.LIBRARY)) {
157 element = element.enclosingElement; 157 element = element.enclosingElement;
158 } 158 }
159 return element; 159 return element;
160 } 160 }
161 161
162 ClassElement get enclosingClass { 162 ClassElement get enclosingClass {
163 for (Element e = this; e != null; e = e.enclosingElement) { 163 for (Element e = this; e != null; e = e.enclosingElement) {
164 if (e.isClass) return e; 164 if (e.isClass) return e;
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 709
710 void forEachLocalMember(f(Element element)) { 710 void forEachLocalMember(f(Element element)) {
711 localMembers.forEach(f); 711 localMembers.forEach(f);
712 } 712 }
713 713
714 void addMember(Element element, DiagnosticReporter reporter) { 714 void addMember(Element element, DiagnosticReporter reporter) {
715 // Keep a list of top level members. 715 // Keep a list of top level members.
716 localMembers = localMembers.prepend(element); 716 localMembers = localMembers.prepend(element);
717 // Provide the member to the library to build scope. 717 // Provide the member to the library to build scope.
718 if (enclosingElement.isPatch) { 718 if (enclosingElement.isPatch) {
719 implementationLibrary.addMember(element, reporter); 719 LibraryElementX library = implementationLibrary;
720 library.addMember(element, reporter);
720 } else { 721 } else {
721 library.addMember(element, reporter); 722 library.addMember(element, reporter);
722 } 723 }
723 } 724 }
724 725
725 void setPartOf(PartOf tag, DiagnosticReporter reporter) { 726 void setPartOf(PartOf tag, DiagnosticReporter reporter) {
726 LibraryElementX library = enclosingElement; 727 LibraryElementX library = enclosingElement;
727 if (library.entryCompilationUnit == this) { 728 if (library.entryCompilationUnit == this) {
728 // This compilation unit is loaded as a library. The error is reported by 729 // This compilation unit is loaded as a library. The error is reported by
729 // the library loader. 730 // the library loader.
(...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 if (definingElement.isField) { 3246 if (definingElement.isField) {
3246 FieldElement field = definingElement; 3247 FieldElement field = definingElement;
3247 body = field.initializer; 3248 body = field.initializer;
3248 } else if (node != null && node.asFunctionExpression() != null) { 3249 } else if (node != null && node.asFunctionExpression() != null) {
3249 body = node.asFunctionExpression().body; 3250 body = node.asFunctionExpression().body;
3250 } 3251 }
3251 return new ParsedResolvedAst( 3252 return new ParsedResolvedAst(
3252 declaration, node, body, definingElement.treeElements); 3253 declaration, node, body, definingElement.treeElements);
3253 } 3254 }
3254 } 3255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698