Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 86 additions & 86 deletions Nodejs/Product/Analysis/Analysis/GlobalBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1681,94 +1681,94 @@ private static IAnalysisSet StringToLowerCase(FunctionValue func, Node node, Ana
return unit.Analyzer._emptyStringValue.SelfSet;
}
return res;
}
#region Constructor Overloads
private OverloadResult[] ArrayOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult("Array", "Create a new and empty array."),
new SimpleOverloadResult("Array", "Create a new array with specific length.",
Parameter("length", "Length of the new array. Must be between 0 and 2^32-1, inclusive.")),
new SimpleOverloadResult("Array", "Create a new array with initial elements.",
Parameter("item1", "Initial element of the array."),
Parameter("item2", "Initial element of the array."),
Parameter("[...]", "Initial element of the array."))
};
}
private OverloadResult[] StringOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult(
"String",
"Create a new string.",
Parameter("thing", "Anything to be converted to a string. If unspecified, an empty string is returned.", isOptional: true)
)
};
}
private OverloadResult[] NumberOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult(
"Number",
"Create a new object wrapper for a numerical value.",
Parameter("value", "The numeric value of the number being created. If unspecified, 0 is returned.", isOptional: true)
)
};
}
private OverloadResult[] BooleanOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult(
"Boolean",
"Create a new object wrapper for a boolean value.",
Parameter("value", "The initial value of the Boolean object. In unspecified, <false> is returned.", isOptional: true)
)
};
}
private OverloadResult[] ErrorOverloads(string errorName = "Error") {
return new OverloadResult[] {
new SimpleOverloadResult(
errorName,
String.Format("Create an {0} object.", errorName),
Parameter("message", "Human-readable description of the error.", isOptional: true)
)
};
}
private OverloadResult[] ObjectOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult(
"Object",
"Create an object wrapper that corresponds to a given value.",
Parameter("value", "Any value. If the value is unspecified, null or undefined, returns an empty object.", isOptional: true))
};
}
private OverloadResult[] RegExpOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult("RegExp", "Create a regular expression for matching text with a pattern.",
Parameter("pattern", "The text of the regular expression"),
Parameter("flags", "A combination of g (global match), i (ignore case) and m (multiline).", isOptional: true))
};
}
private OverloadResult[] FunctionOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult("Function", "Create a new and empty function."),
new SimpleOverloadResult("Function", "Create a new function.",
Parameter("body", "A string containing the JavaScript statements comprising the function definition.")),
new SimpleOverloadResult("Function", "Create a new function with arguments.",
Parameter("arg...", "Name of argument of the function.", isOptional: true),
Parameter("body", "A string containing the JavaScript statements comprising the function definition."))
};
}
}

#region Constructor Overloads

private OverloadResult[] ArrayOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult("Array", "Create a new and empty array."),
new SimpleOverloadResult("Array", "Create a new array with specific length.",
Parameter("length", "Length of the new array. Must be between 0 and 2^32-1, inclusive.")),
new SimpleOverloadResult("Array", "Create a new array with initial elements.",
Parameter("item1", "Initial element of the array."),
Parameter("item2", "Initial element of the array."),
Parameter("[...]", "Initial element of the array."))
};
}

private OverloadResult[] StringOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult(
"String",
"Create a new string.",
Parameter("thing", "Anything to be converted to a string. If unspecified, an empty string is returned.", isOptional: true)
)
};
}

private OverloadResult[] NumberOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult(
"Number",
"Create a new object wrapper for a numerical value.",
Parameter("value", "The numeric value of the number being created. If unspecified, 0 is returned.", isOptional: true)
)
};
}

private OverloadResult[] BooleanOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult(
"Boolean",
"Create a new object wrapper for a boolean value.",
Parameter("value", "The initial value of the Boolean object. In unspecified, <false> is returned.", isOptional: true)
)
};
}

private OverloadResult[] ErrorOverloads(string errorName = "Error") {
return new OverloadResult[] {
new SimpleOverloadResult(
errorName,
String.Format("Create an {0} object.", errorName),
Parameter("message", "Human-readable description of the error.", isOptional: true)
)
};
}

private OverloadResult[] ObjectOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult(
"Object",
"Create an object wrapper that corresponds to a given value.",
Parameter("value", "Any value. If the value is unspecified, null or undefined, returns an empty object.", isOptional: true))
};
}

private OverloadResult[] RegExpOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult("RegExp", "Create a regular expression for matching text with a pattern.",
Parameter("pattern", "The text of the regular expression"),
Parameter("flags", "A combination of g (global match), i (ignore case) and m (multiline).", isOptional: true))
};
}

private OverloadResult[] FunctionOverloads() {
return new OverloadResult[] {
new SimpleOverloadResult("Function", "Create a new and empty function."),
new SimpleOverloadResult("Function", "Create a new function.",
Parameter("body", "A string containing the JavaScript statements comprising the function definition.")),
new SimpleOverloadResult("Function", "Create a new function with arguments.",
Parameter("arg...", "Name of argument of the function.", isOptional: true),
Parameter("body", "A string containing the JavaScript statements comprising the function definition."))
};
}

#endregion

#region Building Helpers

private static MemberAddInfo Member(string name, AnalysisValue value) {
return new MemberAddInfo(name, value);
}
Expand Down
4 changes: 2 additions & 2 deletions Nodejs/Product/Analysis/Analysis/OverloadResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public virtual ParameterResult[] Parameters {
class SimpleOverloadResult : OverloadResult {
private readonly string _documentation;

public SimpleOverloadResult(string name, string documentation) : base(name) {
_documentation = documentation;
public SimpleOverloadResult(string name, string documentation) : base(name) {
_documentation = documentation;
}

public SimpleOverloadResult(string name, string documentation, params ParameterResult[] parameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ internal class SpecializedFunctionValue : BuiltinFunctionValue {
public SpecializedFunctionValue(ProjectEntry projectEntry, string name, CallDelegate func, string documentation = null, ExpandoValue prototype = null, params ParameterResult[] signature)
: base(projectEntry, name, documentation, prototype, signature) {
_func = func;
}
public SpecializedFunctionValue(ProjectEntry projectEntry, string name, CallDelegate func, OverloadResult[] overloads, string documentation = null, ExpandoValue prototype = null)
: base(projectEntry, name, overloads, documentation, prototype)
}

public SpecializedFunctionValue(ProjectEntry projectEntry, string name, CallDelegate func, OverloadResult[] overloads, string documentation = null, ExpandoValue prototype = null)
: base(projectEntry, name, overloads, documentation, prototype)
{
_func = func;
}
Expand Down