CYTypeExpression(&typed).Output(out, CYNoBFC);
value << ".withName(\"" << name << "\")";
- name += "$cye";
+ name = "$cye" + name;
flags = CYBridgeType;
// the enum constants are implemented separately *also*
CYTypeExpression(&typed).Output(out, CYNoBFC);
value << ".withName(\"" << name << "\")";
- name += "$cys";
+ name = "$cys" + name;
flags = CYBridgeType;
} break;
expression = $M(driver.context_, $S("$cyr"));
break;
+ case CYDriver::AutoStruct:
+ expression = $ CYThis();
+ prefix << "$cys";
+ break;
+
+ case CYDriver::AutoEnum:
+ expression = $ CYThis();
+ prefix << "$cye";
+ break;
+
default:
_assert(false);
}
" if (false) {\n"
" for (var name in object)\n"
" if (name.substring(0, entire) == prefix)\n"
- " names.push(name.substr(before));\n"
+ " names.push(name);\n"
" } else do {\n"
" if (object.hasOwnProperty(\"cy$complete\")) {\n"
" names = names.concat(object.cy$complete(prefix));\n"
" }\n"
" for (var name of local)\n"
" if (name.substring(0, entire) == prefix)\n"
- " names.push(name.substr(before));\n"
+ " names.push(name);\n"
" } while (object = typeof object === 'object' ? Object.getPrototypeOf(object) : object.__proto__);\n"
" return names;\n"
" }\n"
else
continue;
+ completion.data += begin.size();
+ completion.size -= begin.size();
+
if (CYStartsWith(completion, "$cy"))
continue;
-
completions.push_back(completion);
if (!rest) {
AutoIndirect,
AutoMessage,
AutoResolve,
+ AutoStruct,
+ AutoEnum,
} mode_;
private:
: PrimitiveType[pass] { $$ = $pass; }
| "struct" IdentifierType[name] { $$ = CYNew CYTypeReference(CYTypeReferenceStruct, $name); }
| "enum" IdentifierType[name] { $$ = CYNew CYTypeReference(CYTypeReferenceEnum, $name); }
+ | "struct" AutoComplete { driver.mode_ = CYDriver::AutoStruct; YYACCEPT; }
+ | "enum" AutoComplete { driver.mode_ = CYDriver::AutoEnum; YYACCEPT; }
;
TypedIdentifierMaybe
PrimaryExpression
: "(" LexOf "struct" NewLineOpt IdentifierType[name] TypeQualifierRightOpt[typed] ")" { $typed->specifier_ = CYNew CYTypeReference(CYTypeReferenceStruct, $name); $$ = CYNew CYTypeExpression($typed); }
+ | "(" LexOf "struct" NewLineOpt AutoComplete { driver.mode_ = CYDriver::AutoStruct; YYACCEPT; }
;
/* }}} */
/* Cycript (C): Type Definitions {{{ */
}
CYTarget *CYTypeReference::Replace(CYContext &context) {
- const char *suffix;
+ const char *prefix;
switch (kind_) {
- case CYTypeReferenceStruct: suffix = "$cys"; break;
- case CYTypeReferenceEnum: suffix = "$cye"; break;
+ case CYTypeReferenceStruct: prefix = "$cys"; break;
+ case CYTypeReferenceEnum: prefix = "$cye"; break;
default: _assert(false);
}
- return $V($pool.strcat(name_->Word(), suffix, NULL));
+ return $V($pool.strcat(prefix, name_->Word(), NULL));
}
CYTarget *CYTypeStruct::Replace(CYContext &context) {