diff options
Diffstat (limited to 'plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/types/builtin/StringType.java')
-rw-r--r-- | plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/types/builtin/StringType.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/types/builtin/StringType.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/types/builtin/StringType.java new file mode 100644 index 00000000..88128cb4 --- /dev/null +++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/types/builtin/StringType.java @@ -0,0 +1,25 @@ +package org.eclipse.xtend.backend.types.builtin; + +import org.eclipse.xtend.backend.common.BackendType; +import org.eclipse.xtend.backend.types.AbstractType; + + +/** + * The canonical, internal representation of a string object is "anything that implements CharSequence", i.e. + * a function that accepts a parameter of type string must accept any CharSequence. This is done to + * enable internal optimizations like lazy concatenation and streaming.<p> + * + * This has the consequence that functions may need to convert a given CharSequence to whatever more specific + * string representation they need internally. + * + * @author Arno Haase (http://www.haase-consulting.com) + */ +public final class StringType extends AbstractType { + public static final StringType INSTANCE = new StringType(); + + private StringType () {super ("String"); } + + public boolean isAssignableFrom (BackendType other) { + return other == this || other == VoidType.INSTANCE; + } +} |