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

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart

Issue 2488543002: fix #27775, enum declaration where "name" is a property (Closed)
Patch Set: Created 4 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// This library defines the operations that define and manipulate Dart 5 /// This library defines the operations that define and manipulate Dart
6 /// classes. Included in this are: 6 /// classes. Included in this are:
7 /// - Generics 7 /// - Generics
8 /// - Class metadata 8 /// - Class metadata
9 /// - Extension methods 9 /// - Extension methods
10 /// 10 ///
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 /// 533 ///
534 /// The constructor 534 /// The constructor
535 defineNamedConstructorCallable(clazz, name, ctor) => JS( 535 defineNamedConstructorCallable(clazz, name, ctor) => JS(
536 '', 536 '',
537 '''(() => { 537 '''(() => {
538 ctor.prototype = $clazz.prototype; 538 ctor.prototype = $clazz.prototype;
539 // Use defineProperty so we don't hit a property defined on Function, 539 // Use defineProperty so we don't hit a property defined on Function,
540 // like `caller` and `arguments`. 540 // like `caller` and `arguments`.
541 $defineProperty($clazz, $name, { value: ctor, configurable: true }); 541 $defineProperty($clazz, $name, { value: ctor, configurable: true });
542 })()'''); 542 })()''');
543
544 defineEnumValues(enumClass, names) => JS(
545 '',
546 '''(() => {
547 let values = [];
548 for (var i = 0; i < $names.length; i++) {
549 let value = $const_(new $enumClass(i));
550 values.push(value);
551 Object.defineProperty($enumClass, $names[i],
552 { value: value, configurable: true });
553 }
554 $enumClass.values = $constList(values, $enumClass);
555 })()''');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698