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

Unified Diff: pkg/fletchc/lib/src/model.dart

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/fletchc/lib/src/messages.dart ('k') | pkg/fletchc/lib/src/please_report_crash.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/fletchc/lib/src/model.dart
diff --git a/pkg/fletchc/lib/src/model.dart b/pkg/fletchc/lib/src/model.dart
deleted file mode 100644
index f5ca1ea15916b8f35d09dd8c5175f95453ce0123..0000000000000000000000000000000000000000
--- a/pkg/fletchc/lib/src/model.dart
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE.md file.
-
-library fletchc.model;
-
-import 'dart:mirrors' as mirrors;
-
-/**
- * Indirection from the class mirror. This allows us to adapt the interface
- * here as needed.
- */
-class ClassMirror implements mirrors.ClassMirror {
- mirrors.ClassMirror _raw;
-
- Map<Symbol, mirrors.DeclarationMirror> get declarations => _raw.declarations;
-
- mirrors.InstanceMirror getField(Symbol fieldName) => _raw.getField(fieldName);
-
- bool get hasReflectedType => _raw.hasReflectedType;
-
- Map<Symbol, mirrors.MethodMirror> get instanceMembers => _raw.instanceMembers;
-
- bool get isAbstract => _raw.isAbstract;
-
- bool isAssignableTo(mirrors.TypeMirror other) => _raw.isAssignableTo(other);
-
- bool get isEnum => _raw.isEnum;
-
- bool get isOriginalDeclaration => _raw.isOriginalDeclaration;
-
- bool get isPrivate => _raw.isPrivate;
-
- bool isSubclassOf(mirrors.ClassMirror other) => _raw.isSubclassOf(other);
-
- bool isSubtypeOf(mirrors.TypeMirror other) => _raw.isSubtypeOf(other);
-
- bool get isTopLevel => _raw.isTopLevel;
-
- mirrors.SourceLocation get location => _raw.location;
-
- mirrors.ClassMirror get mixin => _raw.mixin;
-
- List<mirrors.InstanceMirror> get metadata => _raw.metadata;
-
- mirrors.ClassMirror get superclass => _raw.superclass;
-
- List<mirrors.ClassMirror> get superinterfaces => _raw.superinterfaces;
-
- List<mirrors.TypeMirror> get typeArguments => _raw.typeArguments;
-
- List<mirrors.TypeVariableMirror> get typeVariables => _raw.typeVariables;
-
- mirrors.TypeMirror get originalDeclaration => _raw.originalDeclaration;
-
- mirrors.DeclarationMirror get owner => _raw.owner;
-
- Symbol get qualifiedName => _raw.qualifiedName;
-
- Type get reflectedType => _raw.reflectedType;
-
- Symbol get simpleName => _raw.simpleName;
-
- Map<Symbol, mirrors.MethodMirror> get staticMembers => _raw.staticMembers;
-
- mirrors.InstanceMirror newInstance(
- Symbol constructorName,
- List positionalArguments,
- [Map<Symbol, dynamic> namedArguments]) {
- throw ("Not implemented here.");
- }
-
- mirrors.InstanceMirror invoke(
- Symbol memberName,
- List positionalArguments,
- [Map<Symbol, dynamic> namedArguments]) {
- throw ("Not implemented here.");
- }
-
- mirrors.InstanceMirror setField(Symbol fieldName, Object value) {
- throw ("Not implemented here.");
- }
-
- ClassBuilder get builder {
- return new ClassBuilder(this);
- }
-
-}
-
-/**
- * [ClassBuilder] represents a set of changes to be previewed or applied
- * to a class.
- */
-class ClassBuilder {
- /**
- * Should the entire class be deleted?
- */
- bool deleteClass = false;
-
- /**
- * The class mirror that this builder was derived from.
- */
- final ClassMirror original;
-
- /**
- * The definition of the change to the header of the class
- * An empty string implies no change.
- * for example: "class Foo extends Bar"
- */
- String classHeader = "";
-
- /**
- * A map of how the instance members of [original] should
- * look after this builder has been applied.
- */
- final Map<String, MirrorBuilder> instanceMembers = {};
-
- /**
- * A map of how the static members of [original] should
- * look after this builder has been applied.
- */
- final Map<String, MirrorBuilder> staticMembers = {};
-
- /**
- * A map of how the fields of [original] should
- * look after this builder has been applied.
- */
- final Map<String, MirrorBuilder> fields = {};
-
- ClassBuilder(this.original) {
-
- // Setup with no changes by default.
-
- original.staticMembers.forEach((symbol, methodMirror) {
- String name = mirrors.MirrorSystem.getName(symbol);
- staticMembers.putIfAbsent(
- name, () => new MirrorBuilder.fromMirror(methodMirror));
- });
-
- original.instanceMembers.forEach((symbol, methodMirror) {
- String name = mirrors.MirrorSystem.getName(symbol);
- staticMembers.putIfAbsent(
- name, () => new MirrorBuilder.fromMirror(methodMirror));
- });
-
- // TODO(lukechurch): Do the same thing for fields.
- }
-
- /**
- * Construct a new class from [classHeader].
- */
- ClassBuilder.fromEmpty(this.classHeader) : original = null;
-}
-
-/**
- * Used to assemble a change to a [ClassBuilder].
- */
-class MirrorBuilder {
- final String newSource;
- final mirrors.DeclarationMirror reuseFrom;
-
- /**
- * Represents a replacement of the implementation of a declaration with
- * a new version from [newSource].
- */
- MirrorBuilder.fromSource(this.newSource)
- : this.reuseFrom = null;
-
- /**
- * Represents reusing the implementation from [reuseFrom].
- */
- MirrorBuilder.fromMirror(this.reuseFrom)
- : this.newSource = null;
-
- bool get hasSource => newSource != null;
- bool get isReusing => reuseFrom != null;
-}
-
« no previous file with comments | « pkg/fletchc/lib/src/messages.dart ('k') | pkg/fletchc/lib/src/please_report_crash.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698