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

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

Issue 2935593002: Attempt to instantiate an enum class is a compile-time error. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | tests/co19/co19-kernel.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 '../fasta_codes.dart' 7 import '../fasta_codes.dart'
8 show 8 show
9 FastaMessage, 9 FastaMessage,
10 codeConstFieldWithoutInitializer, 10 codeConstFieldWithoutInitializer,
(...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 return; 2144 return;
2145 } 2145 }
2146 2146
2147 if (typeArguments != null) { 2147 if (typeArguments != null) {
2148 assert(arguments.types.isEmpty); 2148 assert(arguments.types.isEmpty);
2149 KernelArguments.setExplicitArgumentTypes(arguments, typeArguments); 2149 KernelArguments.setExplicitArgumentTypes(arguments, typeArguments);
2150 } 2150 }
2151 2151
2152 String errorName; 2152 String errorName;
2153 if (type is ClassBuilder) { 2153 if (type is ClassBuilder) {
2154 if (type is EnumBuilder) {
2155 push(buildCompileTimeError(
2156 "An enum class can't be instantiated.", nameToken.charOffset));
2157 return;
2158 }
2154 Builder b = 2159 Builder b =
2155 type.findConstructorOrFactory(name, token.charOffset, uri, library); 2160 type.findConstructorOrFactory(name, token.charOffset, uri, library);
2156 Member target; 2161 Member target;
2157 Member initialTarget; 2162 Member initialTarget;
2158 if (b == null) { 2163 if (b == null) {
2159 // Not found. Reported below. 2164 // Not found. Reported below.
2160 } else if (b.isConstructor) { 2165 } else if (b.isConstructor) {
2161 initialTarget = b.target; 2166 initialTarget = b.target;
2162 if (type.isAbstract) { 2167 if (type.isAbstract) {
2163 push(evaluateArgumentsBefore( 2168 push(evaluateArgumentsBefore(
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after
3564 if (starToken == null) { 3569 if (starToken == null) {
3565 return AsyncMarker.Async; 3570 return AsyncMarker.Async;
3566 } else { 3571 } else {
3567 assert(identical(starToken.stringValue, "*")); 3572 assert(identical(starToken.stringValue, "*"));
3568 return AsyncMarker.AsyncStar; 3573 return AsyncMarker.AsyncStar;
3569 } 3574 }
3570 } else { 3575 } else {
3571 return internalError("Unknown async modifier: $asyncToken"); 3576 return internalError("Unknown async modifier: $asyncToken");
3572 } 3577 }
3573 } 3578 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698