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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2761173004: Implement dynamic and void as types exported by core library. (Closed)
Patch Set: Use TypeBuilder.bind. Created 3 years, 9 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.body_builder; 5 library fasta.body_builder;
6 6
7 import '../parser/parser.dart' show FormalParameterType, optional; 7 import '../parser/parser.dart' show FormalParameterType, optional;
8 8
9 import '../parser/error_kind.dart' show ErrorKind; 9 import '../parser/error_kind.dart' show ErrorKind;
10 10
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 push(builderToFirstExpression(builder, name, token.charOffset)); 739 push(builderToFirstExpression(builder, name, token.charOffset));
740 } else { 740 } else {
741 push(new Identifier(name)..fileOffset = token.charOffset); 741 push(new Identifier(name)..fileOffset = token.charOffset);
742 } 742 }
743 } 743 }
744 744
745 @override 745 @override
746 builderToFirstExpression(Builder builder, String name, int charOffset, 746 builderToFirstExpression(Builder builder, String name, int charOffset,
747 {bool isPrefix: false}) { 747 {bool isPrefix: false}) {
748 if (builder == null || (!isInstanceContext && builder.isInstanceMember)) { 748 if (builder == null || (!isInstanceContext && builder.isInstanceMember)) {
749 if (!isPrefix && identical(name, "dynamic") && builder == null) {
750 return new KernelNamedTypeBuilder(name, null, charOffset, uri);
751 }
752 Name n = new Name(name, library.library); 749 Name n = new Name(name, library.library);
753 if (!isPrefix && isInstanceContext) { 750 if (!isPrefix && isInstanceContext) {
754 assert(builder == null); 751 assert(builder == null);
755 return new ThisPropertyAccessor(this, charOffset, n, null, null); 752 return new ThisPropertyAccessor(this, charOffset, n, null, null);
756 } else { 753 } else {
757 return new UnresolvedIdentifier(n)..fileOffset = charOffset; 754 return new UnresolvedIdentifier(n)..fileOffset = charOffset;
758 } 755 }
759 } else if (builder.isTypeDeclaration) { 756 } else if (builder.isTypeDeclaration) {
760 return builder; 757 return builder;
761 } else if (builder.isLocal) { 758 } else if (builder.isLocal) {
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 List parts = popList(identifierCount); 1181 List parts = popList(identifierCount);
1185 value = symbolPartToString(parts.first); 1182 value = symbolPartToString(parts.first);
1186 for (int i = 1; i < parts.length; i++) { 1183 for (int i = 1; i < parts.length; i++) {
1187 value += ".${symbolPartToString(parts[i])}"; 1184 value += ".${symbolPartToString(parts[i])}";
1188 } 1185 }
1189 } 1186 }
1190 push(new SymbolLiteral(value)); 1187 push(new SymbolLiteral(value));
1191 } 1188 }
1192 1189
1193 DartType toKernelType(String name, List<DartType> arguments, int charOffset) { 1190 DartType toKernelType(String name, List<DartType> arguments, int charOffset) {
1194 if (identical(name, "void")) return const VoidType();
1195 if (identical(name, "dynamic")) return const DynamicType();
1196 Builder builder = scope.lookup(name, charOffset, uri); 1191 Builder builder = scope.lookup(name, charOffset, uri);
1197 if (builder is TypeDeclarationBuilder) { 1192 if (builder is TypeDeclarationBuilder) {
1198 return builder.buildTypesWithBuiltArguments(library, arguments); 1193 return builder.buildTypesWithBuiltArguments(library, arguments);
1199 } 1194 }
1200 if (builder == null) { 1195 if (builder == null) {
1201 warning("Type not found: '$name'.", charOffset); 1196 warning("Type not found: '$name'.", charOffset);
1202 } else { 1197 } else {
1203 warning("Not a type: '$name'.", charOffset); 1198 warning("Not a type: '$name'.", charOffset);
1204 } 1199 }
1205 // TODO(ahe): Create an error somehow. 1200 // TODO(ahe): Create an error somehow.
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after
2747 } else if (node is PrefixBuilder) { 2742 } else if (node is PrefixBuilder) {
2748 return node.name; 2743 return node.name;
2749 } else if (node is ThisAccessor) { 2744 } else if (node is ThisAccessor) {
2750 return node.isSuper ? "super" : "this"; 2745 return node.isSuper ? "super" : "this";
2751 } else if (node is BuilderAccessor) { 2746 } else if (node is BuilderAccessor) {
2752 return node.plainNameForRead; 2747 return node.plainNameForRead;
2753 } else { 2748 } else {
2754 return internalError("Unhandled: ${node.runtimeType}"); 2749 return internalError("Unhandled: ${node.runtimeType}");
2755 } 2750 }
2756 } 2751 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698