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/elements/modelx.dart

Issue 548253003: First end-to-end capability in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 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 | Annotate | Revision Log
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 'elements.dart'; 7 import 'elements.dart';
8 import '../helpers/helpers.dart'; // Included for debug helpers. 8 import '../helpers/helpers.dart'; // Included for debug helpers.
9 import '../tree/tree.dart'; 9 import '../tree/tree.dart';
10 import '../util/util.dart'; 10 import '../util/util.dart';
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 262 }
263 263
264 class ErroneousElementX extends ElementX implements ErroneousElement { 264 class ErroneousElementX extends ElementX implements ErroneousElement {
265 final MessageKind messageKind; 265 final MessageKind messageKind;
266 final Map messageArguments; 266 final Map messageArguments;
267 267
268 ErroneousElementX(this.messageKind, this.messageArguments, 268 ErroneousElementX(this.messageKind, this.messageArguments,
269 String name, Element enclosing) 269 String name, Element enclosing)
270 : super(name, ElementKind.ERROR, enclosing); 270 : super(name, ElementKind.ERROR, enclosing);
271 271
272 bool get isTopLevel => false;
273
272 bool get isSynthesized => true; 274 bool get isSynthesized => true;
273 275
274 AbstractFieldElement abstractField; 276 AbstractFieldElement abstractField;
275 277
276 unsupported() { 278 unsupported() {
277 throw 'unsupported operation on erroneous element'; 279 throw 'unsupported operation on erroneous element';
278 } 280 }
279 281
280 Link<MetadataAnnotation> get metadata => unsupported(); 282 Link<MetadataAnnotation> get metadata => unsupported();
281 bool get hasNode => false; 283 bool get hasNode => false;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 listener.withCurrentElement(importer, () { 421 listener.withCurrentElement(importer, () {
420 for (; !importers.isEmpty; importers = importers.tail) { 422 for (; !importers.isEmpty; importers = importers.tail) {
421 listener.reportInfo( 423 listener.reportInfo(
422 importers.head, MessageKind.IMPORTED_HERE, arguments); 424 importers.head, MessageKind.IMPORTED_HERE, arguments);
423 } 425 }
424 }); 426 });
425 } 427 }
426 } 428 }
427 429
428 accept(ElementVisitor visitor) => visitor.visitAmbiguousElement(this); 430 accept(ElementVisitor visitor) => visitor.visitAmbiguousElement(this);
431
432 bool get isTopLevel => false;
429 } 433 }
430 434
431 class ScopeX { 435 class ScopeX {
432 final Map<String, Element> contents = new Map<String, Element>(); 436 final Map<String, Element> contents = new Map<String, Element>();
433 437
434 bool get isEmpty => contents.isEmpty; 438 bool get isEmpty => contents.isEmpty;
435 Iterable<Element> get values => contents.values; 439 Iterable<Element> get values => contents.values;
436 440
437 Element lookup(String name) { 441 Element lookup(String name) {
438 return contents[name]; 442 return contents[name];
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 [Uri canonicalUri, LibraryElementX origin]) 733 [Uri canonicalUri, LibraryElementX origin])
730 : this.canonicalUri = 734 : this.canonicalUri =
731 ((canonicalUri == null) ? script.readableUri : canonicalUri), 735 ((canonicalUri == null) ? script.readableUri : canonicalUri),
732 super(script.name, ElementKind.LIBRARY, null) { 736 super(script.name, ElementKind.LIBRARY, null) {
733 entryCompilationUnit = new CompilationUnitElementX(script, this); 737 entryCompilationUnit = new CompilationUnitElementX(script, this);
734 if (origin != null) { 738 if (origin != null) {
735 origin.applyPatch(this); 739 origin.applyPatch(this);
736 } 740 }
737 } 741 }
738 742
743 bool get isDartCore => canonicalUri == Compiler.DART_CORE;
744
739 Link<MetadataAnnotation> get metadata { 745 Link<MetadataAnnotation> get metadata {
740 return (libraryTag == null) ? super.metadata : libraryTag.metadata; 746 return (libraryTag == null) ? super.metadata : libraryTag.metadata;
741 } 747 }
742 748
743 set metadata(value) { 749 set metadata(value) {
744 // The metadata is stored on [libraryTag]. 750 // The metadata is stored on [libraryTag].
745 throw new SpannableAssertionFailure(this, 'Cannot set metadata on Library'); 751 throw new SpannableAssertionFailure(this, 'Cannot set metadata on Library');
746 } 752 }
747 753
748 CompilationUnitElement get compilationUnit => entryCompilationUnit; 754 CompilationUnitElement get compilationUnit => entryCompilationUnit;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 976
971 bool get isDeferred => _deferredImport != null; 977 bool get isDeferred => _deferredImport != null;
972 978
973 // Only needed for deferred imports. 979 // Only needed for deferred imports.
974 Import _deferredImport; 980 Import _deferredImport;
975 Import get deferredImport => _deferredImport; 981 Import get deferredImport => _deferredImport;
976 982
977 PrefixElementX(String prefix, Element enclosing, this.firstPosition) 983 PrefixElementX(String prefix, Element enclosing, this.firstPosition)
978 : super(prefix, ElementKind.PREFIX, enclosing); 984 : super(prefix, ElementKind.PREFIX, enclosing);
979 985
986 bool get isTopLevel => false;
987
980 Element lookupLocalMember(String memberName) => importScope[memberName]; 988 Element lookupLocalMember(String memberName) => importScope[memberName];
981 989
982 DartType computeType(Compiler compiler) => const DynamicType(); 990 DartType computeType(Compiler compiler) => const DynamicType();
983 991
984 Token get position => firstPosition; 992 Token get position => firstPosition;
985 993
986 void addImport(Element element, Import import, DiagnosticListener listener) { 994 void addImport(Element element, Import import, DiagnosticListener listener) {
987 importScope.addImport(this, element, import, listener); 995 importScope.addImport(this, element, import, listener);
988 } 996 }
989 997
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 bool isForeign(Backend backend) => true; 1699 bool isForeign(Backend backend) => true;
1692 1700
1693 bool get isSynthesized => true; 1701 bool get isSynthesized => true;
1694 1702
1695 bool get isFunction => false; 1703 bool get isFunction => false;
1696 1704
1697 bool get isDeferredLoaderGetter => true; 1705 bool get isDeferredLoaderGetter => true;
1698 1706
1699 bool get isGetter => true; 1707 bool get isGetter => true;
1700 1708
1709 bool get isTopLevel => true;
1701 // By having position null, the enclosing elements location is printed in 1710 // By having position null, the enclosing elements location is printed in
1702 // error messages. 1711 // error messages.
1703 Token get position => null; 1712 Token get position => null;
1704 1713
1705 FunctionExpression parseNode(DiagnosticListener listener) => null; 1714 FunctionExpression parseNode(DiagnosticListener listener) => null;
1706 1715
1707 bool get hasNode => false; 1716 bool get hasNode => false;
1708 1717
1709 FunctionExpression get node => null; 1718 FunctionExpression get node => null;
1710 } 1719 }
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
2665 AstElement get definingElement; 2674 AstElement get definingElement;
2666 2675
2667 bool get hasResolvedAst => definingElement.hasTreeElements; 2676 bool get hasResolvedAst => definingElement.hasTreeElements;
2668 2677
2669 ResolvedAst get resolvedAst { 2678 ResolvedAst get resolvedAst {
2670 return new ResolvedAst(declaration, 2679 return new ResolvedAst(declaration,
2671 definingElement.node, definingElement.treeElements); 2680 definingElement.node, definingElement.treeElements);
2672 } 2681 }
2673 2682
2674 } 2683 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698